I have this form, I want to be able to validate whether or not there are variables place in to submit, what I want is that you cannot submit it unless Q1-Q5 and Comments have values, unless the deactivate is checked then just the comments needs to have a value.
Here is the form:
<?php
mysql_connect("");
mysql_select_db("");
$query = "";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo "<form method='post' action='submit.php?action=change'>";
echo "<table border=2 bordercolor=#5E3964>\n";
echo "<tr>
<td><font color=#FF0000>Name</font></td>
<td><font color=#FF0000>Home #</font></td>
<td><font color=#FF0000>Work #</font></td>
<td><font color=#FF0000>Car Model</font></td>
</tr>\n";
printf("
<tr>
<input type='hidden' name=RO value='%s'>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
</tr>\n",
$row["RO"],
$row["CUSTOMERNAME"],
$row["HOMEPHONE"],
$row["BUSPHONE"],
$row["MODEL"]
);
echo "<tr>
<td><font color=#FF0000>Follow-Up Needed</font></td>
<td><font color=#FF0000>Call Back</font></td>
<td><font color=#FF0000>Fixed Correctly?</font></td>
<td><font color=#FF0000>Treatment?</font></td>
</tr>\n";
printf("
<tr>
<td><input type=checkbox name=FollowUpContact value='1'></td>
<td><input type=checkbox name=CustomerNotReached value='1'></td>
<td><select name=Q1><option selected></option><option>N</option><option>Y</option></select></td>
<td><select name=Q2><option selected></option><option>N</option><option>Y</option></select></td>
</tr>\n",
$row[""]
);
echo "<tr>
<td><font color=#FF0000>Clear Explanation?</font></td>
<td><font color=#FF0000>Overall Service?</font></td>
<td><font color=#FF0000>Why Not Fixed?</font></td>
<td><font color=#FF0000>Comments</font></td>
</tr>\n";
printf("
<tr>
<td><select name=Q3><option selected></option><option>N</option><option>Y</option></select></td>
<td><select name=Q4><option selected></option><option>N</option><option>Y</option></select></td>
<td><select name=Q5><option selected></option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option></select></td>
<td><input type=text name=Comments value='%s'></td>
</tr>\n",
$row["Comments"]
);
echo "<tr>
<td><font color=#FF0000>Happy</font></td>
<td><font color=#FF0000>Close Date</font></td>
<td><font color=#FF0000>Deactivate</font></td>
<td></td>
</tr>\n";
printf("
<tr>
<td><input type=checkbox name=HAPPY value='1'></td>
<td>%s</td>
<td><input type=checkbox name=Deactivate value='1' onclick=\"return confirm('ARE YOU SURE YOU WANT TO DEACTIVATE THIS CUSTOMER?')\" ></td>
<td><input type=submit name=submit value=submit></td>
</form></tr></table>\n",
$row["CLOSEDATE"]
);
}
?>
Thanks in advance.