Jump to content

Is it possible to make an unchecked checkbox pass its value


solarisuser

Recommended Posts

Hello All,

 

Just curious if there is a way to pass a checkbox that is NOT checked with "=> off".  This would be the opposite if a checkbox IS checked, where it is passed with "=> on".

 

Currently, I have a search page that allows users to select a checkbox and clicks the "Send" submit button, the form saves that checkbox value to a session.  When that same search page is refreshed, that checkbox is already checked since the user selected and submitted it.

 

The problem I am trying to tackle is how to let the user "un-check" that box, and click the "Send" submit button, and read from $_POST that it was unchecked.

 

Any Ideas would help.

 

Thanks

You can try

<form>
<input type="hidden" name="check1" value="no">
<input type="checkbox" name="check1" value="yes"> Yes<br>
<input type="submit" name="submit">
</form>

 

This may or may not work on all browsers. Use with caution.

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.