Jump to content

Send server a boolean value


skania

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/278222-send-server-a-boolean-value/
Share on other sites

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.

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.