mercredi 7 janvier 2015

how to apply boolean data into database usign mysql and php?


here is my form. when i checked and not checked the employed checkbox it gives only 0 in the database. how do i fix it?


this is my php code block.



$conn = mysqli_connect('localhost','','','login');

$name=$_POST['name'];
$pword=$_POST['pword'];
$type=$_POST['type'];
$chk=$_POST['chk'];



$sql="insert into login(name,password,type,employed)values('$name','$pword','$type','$chk')";

mysqli_query($conn,$sql);

mysqli_close($conn);

echo "successfully inserted.<br/>";
print "<a href='student.php'>Back</a>";




Aucun commentaire:

Enregistrer un commentaire