jatar_k

msg:1310296 | 7:12 pm on Feb 7, 2003 (gmt 0) |
I think if they have the same name they will just try to pass multiple values into the same var. It is probably easier to give them different names id1, id2 id3, etc. I don't know how you pass the id but here is some guessing. if you have 10 checkboxes like this with hidden id paired to it as hidden vars <input type="checkbox" name="del1" value="yes"> <input type="hidden" name="id1" value="<?= $someid?>"> you could do something like $counter = 1; while ($counter < 11) { $dodel = "del" . $counter; if ($_POST[$dodel] == "yes") { $delid = "id" . $counter; $delquery = "delete from table where id=" . $_POST[$delid]; mysql_query($delquery); } $counter++; } I used a set number but you could also pass the count as a hidden form var and do $counter < $count or something. I also used extra steps in hereto make it alittle easier.
|
aaronc

msg:1310297 | 12:39 am on Feb 8, 2003 (gmt 0) |
This is how you do it. <input type=checkbox name=id[] value=123> <input type=checkbox name=id[] value=456> When you submit the form, the id variable will be an array with whatever values are checked. If both checkboes are checked, the array will have 2 values in there 123 & 456
|
andreasfriedrich

msg:1310298 | 1:26 am on Feb 8, 2003 (gmt 0) |
The PHP manual is a rather good resource to learn about PHP. It´s PHP´s manual after all. [php.net...] Andreas
|
empires

msg:1310299 | 8:00 pm on Feb 8, 2003 (gmt 0) |
This is how you do it. <input type=checkbox name=id[] value=123> <input type=checkbox name=id[] value=456> |
| That's the method. Also remember in the ACTION script processing the form entries to first check that isset($_POST['id']) because (unlike a radio button) you may have situations where NONE of the checkboxes are selected, and thus $id array won't exist and would be undefined when referenced in the form processing script.
|
jatar_k

msg:1310300 | 8:09 pm on Feb 8, 2003 (gmt 0) |
Welcome to WebmasterWorld empires
|
get2jean

msg:1310301 | 4:09 pm on Feb 13, 2003 (gmt 0) |
how do you do the same thing as: - "if you have 10 checkboxes like this with hidden id paired to it as hidden vars <input type="checkbox" name="del1" value="yes"> <input type="hidden" name="id1" value="<?= $someid?>"> you could do something like $counter = 1; while ($counter < 11) { $dodel = "del" . $counter; if ($_POST[$dodel] == "yes") { $delid = "id" . $counter; $delquery = "delete from table where id=" . $_POST[$delid]; mysql_query($delquery); } $counter++; } " if the number of checkboxes can change each time?
|
|