Forum Moderators: open

Message Too Old, No Replies

Bringing over value of checkbox

         

theriddla1019

4:03 pm on Feb 23, 2005 (gmt 0)

10+ Year Member



I have a php add page that grabs all the posted variables and their input names. Now everything works fine except that when i go to update a page and "uncheck" a checkbox and send it over to the edit page im guessing html does not see an unchecked checkbox as having a value so it does not post it under the form method. Is there any check to set or check the on or off state of a checkbox or is there a value i can set in the input to make it have a value being off?

tedster

1:35 pm on Mar 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are correct that an unchecked checkbox has a 'null' value, and not a 'false' value. If you need to move that data to another page, or into a database, I think you need some additional scripting that first sets every form item to 'false', and then updates the checked ones to 'true' according to the retrieved form values.

This kind of scripting is not my strong suit, but I'll bet the folks in our PHP Forum [webmasterworld.com] can help.