Jump to content

checkbox value = 1 if checked?


Gayner

Recommended Posts

Private?: <input type="checkbox" name="private" />

 

now my php for update is

 

$private = $_POST['private'];

mysql_query("INSERT INTO `prays` (`title` ,`text` ,`private` ,`time`) VALUES (
'". mysql_real_escape_string($_POST['title']) ."',
'". mysql_real_escape_string($_POST['text']) ."',
'". mysql_real_escape_string($_POST['private']) ."',
'$time');");

 

 

 

and im getting:

 

when it insert to database if somone clicks on the checkbox it still 0

 

i need it to be value =1 if somone clicks

 

Link to comment
https://forums.phpfreaks.com/topic/181556-checkbox-value-1-if-checked/
Share on other sites

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.