Hi
Three's the charm? I've been working on this for days now and still it's not working. I've had this on the board a couple times. Do seem to be getting close.
What I'm trying to do is use checkboxes to select individual rows for multiple updates into a table.
Only the last row on the list is executing in the SQL update.
After a query the output is being formatted basically as...
while ($row = mysql_fetch_array($sql_result)) {
$n1 = $row["zone"];
$n2 = $row["date_last_visited"];
echo "<td><input type='Checkbox' name='check[$n1]' value='http://www.phpbuilder.com/board/archive/index.php/$n1'></td>
/* I had to add the 'value' to 'check' in order to get 'zone($n1)' to show up on page 2. Otherwise it just prints 'on'. Was using hidden field. */
<td><input type='text' size='10' name='date[$n1]'></td>"; {
Everything seems to be going to the second page correctly. On the second page I have...
//connect to database
While(List($key,)=each($check)) {
echo "$check[$key]<br>";
echo "$date[$key]<br>";
$sql = "update assign set truck_no = '', driver = '', date_last_visited = '$date[$key]', current_status = 'off' where zone = '$key'";
}
// Close database
Thanks again!
Richard
Three's the charm? I've been working on this for days now and still it's not working. I've had this on the board a couple times. Do seem to be getting close.
What I'm trying to do is use checkboxes to select individual rows for multiple updates into a table.
Only the last row on the list is executing in the SQL update.
After a query the output is being formatted basically as...
while ($row = mysql_fetch_array($sql_result)) {
$n1 = $row["zone"];
$n2 = $row["date_last_visited"];
echo "<td><input type='Checkbox' name='check[$n1]' value='http://www.phpbuilder.com/board/archive/index.php/$n1'></td>
/* I had to add the 'value' to 'check' in order to get 'zone($n1)' to show up on page 2. Otherwise it just prints 'on'. Was using hidden field. */
<td><input type='text' size='10' name='date[$n1]'></td>"; {
Everything seems to be going to the second page correctly. On the second page I have...
//connect to database
While(List($key,)=each($check)) {
echo "$check[$key]<br>";
echo "$date[$key]<br>";
$sql = "update assign set truck_no = '', driver = '', date_last_visited = '$date[$key]', current_status = 'off' where zone = '$key'";
}
// Close database
Thanks again!
Richard