[solved] Forms (checkboxes)
Posted: Mon Jun 11, 2007 1:25 am
I was wondering if there was a way to know just what checkboxes were selected when a Submit button is pressed. I cannot simply 'if (isset($_GET['chk1']))'. The reason for this is that the names of the checkboxes are dynamic, the name could be chk1, chk2, or even chk100.
Right now, the checkboxes are named 'chk#'. The number is the id of the item pulled down from a db. To sort of simulate what the names would be I have to select all rows on my table and put the ids into an array. I then run a foreach loop seeing if chk(id) is set. This seems like a terrible way to ultimetly just find out what checkboxes were marked. Especially since my URLs end up looking like this:
actions.php?chk63=checkbox&chk1=checkbox&btnsubmit=Submit
The answer is right in vars presented in the url, but i dont know how to recognized them.
Please help.
Right now, the checkboxes are named 'chk#'. The number is the id of the item pulled down from a db. To sort of simulate what the names would be I have to select all rows on my table and put the ids into an array. I then run a foreach loop seeing if chk(id) is set. This seems like a terrible way to ultimetly just find out what checkboxes were marked. Especially since my URLs end up looking like this:
actions.php?chk63=checkbox&chk1=checkbox&btnsubmit=Submit
The answer is right in vars presented in the url, but i dont know how to recognized them.
Please help.