Here is the code, it is only updating the last entry, want it to update all the entries on submit. Please help.
<?php
mysql_connect("");
mysql_select_db("");
$query = "SELECT * FROM KEYCAD WHERE Hold LIKE 'Y' AND Active LIKE 'N' ORDER BY CUSTNO AND ContactDate DESC";
$result = mysql_query($query);
echo "<form method='post' action='submit.php?action=change'>";
echo "<table border=2 bordercolor=#5E3964>\n";
echo " <tr>
<td><font color=#FF0000>Set Active</font></td>
<td><font color=#FF0000>Name</font></td>
<td><font color=#FF0000>Home #</font></td>
<td><font color=#FF0000>Bus #</font></td>
<td><font color=#FF0000>Fixed Correctly?</font></td>
<td><font color=#FF0000>Treatment?</font></td>
<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>
<td><font color=#FF0000>Deactivate</font></td>
<td><font color=#FF0000>Follow Up Needed</font></td>
</tr>\n";
while ($currentrow = mysql_fetch_array($result)) {
printf("
<tr>
<input type='hidden' name=RO[] value='%s'>
<td><input type=checkbox name=Active[] value='Y'></td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td><input type=text name=Q1[] value='%s'></td>
<td><input type=text name=Q2[] value='%s'></td>
<td><input type=text name=Q3[] value='%s'></td>
<td><input type=text name=Q4[] value='%s'></td>
<td><input type=text name=Q5[] value='%s'></td>
<td><input type=text name=Comments[] value='%s'></td>
<td><input type=text name=Deacivate[] value='%s'></td>
<td><input type=text name=Follow Up Needed[] value='%s'></td>
</tr>\n",
$currentrow["RO"],
$currentrow["CUSTOMERNAME"],
$currentrow["HOMEPHONE"],
$currentrow["BUSPHONE"],
$currentrow["Q1"],
$currentrow["Q2"],
$currentrow["Q3"],
$currentrow["Q4"],
$currentrow["Q5"],
$currentrow["Comments"],
$currentrow["Deactivate"],
$currentrow["FollowUpContact"]
);
}
echo "</table>";
echo "<input type=Submit name=submit value=Submit>\n";
echo "</form>";
?>
And this is the submit page:
<?php
$RO = $_POST['RO'];
$Active = $_POST['Active'];
$Q1 = $_POST['Q1'];
$Q2 = $_POST['Q2'];
$Q3 = $_POST['Q3'];
$Q4 = $_POST['Q4'];
$Q5 = $_POST['Q5'];
$Comments = $_POST['Comments'];
mysql_connect("");
mysql_select_db("");
for($i = 0; $i < count($RO); $i++){
$query = "UPDATE KEYCAD SET Active='$Active[$i]', Q1='$Q1[$i]', Q2='$Q2[$i]', Q3='$Q3[$i]', Q4='$Q4[$i]', Q5='$Q5[$i]', Comments='$Comments[$i]' WHERE RO='$RO[$i]'";
}
print $query."<br />";
$result = mysql_query($query) or die(mysql_error());
echo"Thank You! Information Updated.\n";
?>
Thanks in advance!