suaveshiva Posted May 28, 2007 Share Posted May 28, 2007 Hi frd's, While using checkbox.... if i check the textbox and submit the value i want Yes option into my database, ok,am getting by placing the value="YES", similarly if i uncheck, am not getting any uncheck values.. so how 2 add "No" in the database,if the checkbox is unchecked?.... I tried by giving thru default value in the database(MYSQL),but am unable 2 get "NO".......... Is their any other solution? plz suggest Thank U inadvance..... Suave shiva Quote Link to comment https://forums.phpfreaks.com/topic/53243-regarding-checkbox-valuesif-checkedtrue-and-for-false/ Share on other sites More sharing options...
eZe616 Posted May 28, 2007 Share Posted May 28, 2007 try something like <?php $checkbox = $_POST['namecheckboxhere']; if ( $checkbox == "Yes") { insert mysql information here } else { $checkbox = "No"; insert mysql information hre; } I dunno about security issues but that should work Quote Link to comment https://forums.phpfreaks.com/topic/53243-regarding-checkbox-valuesif-checkedtrue-and-for-false/#findComment-263109 Share on other sites More sharing options...
suaveshiva Posted May 28, 2007 Author Share Posted May 28, 2007 Yeah.... Its working... Thank U. Quote Link to comment https://forums.phpfreaks.com/topic/53243-regarding-checkbox-valuesif-checkedtrue-and-for-false/#findComment-263110 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.