Kathy_OC Posted June 5, 2008 Share Posted June 5, 2008 I have a multi-screen form where the user creates a record when they click submit on the first screen and then the record is updated as they complete the following screens. It works great for the first two screens, but on the third screen I have 3 checkboxes and I haven't been able to update the checkbox values in my database (MySQL). Each checkbox is a tinyint field in the database and the checkbox value displays correctly when I echo it to the screen. Also, I'm using adodb in case that matters. What do I need to do to get this to work? Thanks, Kathy Here's a code snippet: if ($_POST['chkCIP']) { // box was checked $CIP = 1; } else { // box was not checked $CIP = 0; } echo "CIP = " . $CIP . "<br>"; $result = $db->Execute("UPDATE request SET CIP=? WHERE RequestID=?",array($CIP, $RequestID)); Quote Link to comment Share on other sites More sharing options...
jonsjava Posted June 5, 2008 Share Posted June 5, 2008 the checkbox should return a value (example checkbox) <input type="checkbox" name="test" value="true"> Now, with that said, you check against the checkbox value, not the existence of the checkbox <?php if ($_POST['test'] == "true"){ //do this } else{ //do that } Quote Link to comment Share on other sites More sharing options...
Kathy_OC Posted June 5, 2008 Author Share Posted June 5, 2008 That worked perfectly! Thanks so much!! Kathy Quote Link to comment Share on other sites More sharing options...
jonsjava Posted June 5, 2008 Share Posted June 5, 2008 Any time. If that solved it, please mark this thread complete. 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.