I am having a hard time getting checkboxes. What I would like to do is if it is checked, it go into the database. This is how I've set them up in my database:
tinyint 1, unsigned, null
This is how I've set it up in my html form:
Code: Select all
<form action="" method=POST>
<input type=checkbox name=features[] value=alarm> Alarm
<input type=checkbox name=features[] value=ac>Central AC
<input type=checkbox name=features[] value=cyard>Courtyard
</form>
Code: Select all
<?php
foreach($features as $featuresname)
{
$query = "insert into table (alarm,ac, cyard)values(????????????????????)";
$result = mysql_query($query) or die ("query not made");
?>
Code: Select all
<?php
include ("");
mysql_connect("$host", "$user", "$password") or die ("cannot connect to server");
mysql_select_db("$database") or die ("cannot select DB");
!isset($_POST['features']));
foreach ($features as $featuresname)
{
echo "$featuresname";
}
?>
Thanks,
~Amy