Page 1 of 1

[solved] checkboxes

Posted: Sun Feb 05, 2006 1:08 am
by anthony88guy
I need help with checkboxes; I’ve been fooling around with them for 2 hours. ::blush::

I have multiple checkboxes with the same name (ie. display[]). Now if the checkbox is checked it will display the info, if the checkbox is unchecked it will not. So it updates the database for example the field "display" if set to value "1" display info, if set to "0" do not display info, easy enough. Now I just have to make it work with the checkboxes accordingly.

I’m not asking anyone to write any code, just how should I go about achieving my goal.

Thanks…

Posted: Sun Feb 05, 2006 1:29 am
by feyd
naming them in a self ordering fashion that can map to an existing known array can help. For instance:

Code: Select all

<input name="display[show]" value="1" />
you should have an array of all possibly checked checkboxes. Compare the ~keys you have in it to those submitted. If you do not find it, then it wasn't checked.