03-11-2008, 03:23 PM
|
#2 (permalink)
|
|
The Frequenter
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
|
Make your form dynamically and run through it with a forloop. Like;
Code:
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="checkbox" name="checkbox[]" value="id[]">
</form>
As you can see, both the value and the checkbox has a double bracket, which tells PHP that it's an array (same as the $_POST global).
So, if you want to mass update it, simply put in a forloop;
PHP Code:
for ($i = 0; $i < count($_POST['checkbox']); $i++) { mysql_query('UPDATE myTable SET myRow = "'.$_POST['checkbox'][$i].'" WHERE id = "'.$_POST['id'][$i].'" LIMIT 1'); }
I hope this helps, I haven't tried it but it should work.
__________________
"Life is a bitch, take that bitch on a ride"
|
|
|