...

View Full Version : checkbox



bunny1
03-09-2007, 03:25 PM
Hi

I have a page that has a bunch of check boxes with different names.
Once the user presses the submit button another page opens.
In that page i am trying to write code to check which check boxes are checked on the previous page and add their names to an array.

How can i check the checkboxes from another page?
I have to do it on another page as i am waiting for the submit action to know what boxes have been checked.

Hope this makes some sense!
Any help would be appreciated!

Thanks

Fumigator
03-09-2007, 05:08 PM
Checkboxes are a little goofy because if a checkbox is not checked, it does not carry any data across the request ($_POST or $_GET). If the checkbox is checked, it comes across just like any other form input in the $_POST or $_GET array (I believe the value is the string 'on').

Inigoesdr
03-09-2007, 07:48 PM
If you want/need a value(whether it's on or off you could use
<input type="hidden" name="checkbox" value="off" /> with the same name as the checkbox if you put it before the checkbox it will be overwritten by the checkbox if it's on, and if not you'll get "off" as the value.

Fumigator
03-09-2007, 08:07 PM
Hey that's a pretty good trick, hadn't heard that one before. Nice!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum