<span style="color: #993300; font-weight: bold;">At first Create Database then you create table something like that:</span>
Create table users(
id int(10) not null auto_increment,
checkbox varchar(60) not null,
primary key(id)
) engine=myisam;
Then using PHP coding:
$food = $_POST["food"];
$data="";
/*
foreach($food as $values)
{
$data.=$values.",";
}
*/
//new way .....
$data=implode(",", $food);
$query="insert into users values('','$data')";
$result=mysql_query($query);
<span style="color: #ffcc33; font-weight: bold;"> Create form:</span>
Please choose type of residence:
<input name="food[]" type="checkbox" value="Steak" />Steak
<input name="food[]" type="checkbox" value="Pizza" />Pizza
<input name="food[]" type="checkbox" value="Chicken" />Chicken
<input name="Sub" type="submit" value="Insert" />
No comments:
Post a Comment