Page 1 of 1

Value returned from checkbox?

Posted: Sat Mar 17, 2007 7:14 pm
by Dave2000
This seems like a simple question, but... :?

What value is returned from a checkbox in a form?

For example, if the checkbox was named "word" ie. <input type="checkbox" name="word">...

I looked at Echo $_POST['word'], the value shown was "on", yet an, if ( $_POST['word'] == "on" ) or ( $_POST['word'] == on ) wouldn't return true. I've tried many other things too but none seem to work :?

/me scratches head... Anyone know? :oops:

Posted: Sat Mar 17, 2007 7:20 pm
by John Cartwright
correct me if I'm wrong, but won't it return the value you set?

<input ... value="foobar">

Posted: Sat Mar 17, 2007 7:44 pm
by Dave2000
oh yeah LOL :oops:

I was reading a website, and i cant have been paying attention to it too closely as i just beleived what it said... "Notice that there is no value attribute for checkboxes, as they will either be checked or left blank." Oh wells. Thank you :)