skania Posted May 20, 2013 Share Posted May 20, 2013 I'm a little new to PHP, a little more familiar to SQL but I haven't been able to figure out how to send a boolean value from an html form to the SQL server. I've got the doNotContact in the database as a boolean value, and have a checkbox for the selection: <td>Do Not Contact: </td><td><input type="checkbox" name="doNotContact" value= "True"/></td><br /> But when I write the SQL statement, it fails to get a value. All other values (text/number) work perfectly, except for this, so if anyone has any suggestions - I would appreicate it. Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 20, 2013 Share Posted May 20, 2013 We'd need to see your PHP code, but most likely it will work if you use 0/1 for false/true Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 20, 2013 Share Posted May 20, 2013 Also, are you aware that checkbox values are only passed in the POST/GET data when the checkbox is checked? You would want to do something like this in the code: $doNotContact = isset($_POST['doNotContact']) ? 1 : 0; Then use that value in your query. 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.