solarisuser Posted April 25, 2007 Share Posted April 25, 2007 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 Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted April 25, 2007 Share Posted April 25, 2007 if(!$_POST['checkbox']){ echo "checkbox not checked"; } Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 25, 2007 Share Posted April 25, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.