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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.