form-action.php
/*
mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("formexample") or die (mysql_error());
if(isset($_REQUEST['submit']))
{
$Fname = $_POST["Fname"];
$Lname = $_POST["Lname"];
$gender = $_POST["gender"];
$food = $_POST["food"];
$quote = $_POST["quote"];
$education = $_POST["education"];
$TofD = $_POST["TofD"];
if(empty($Fname))
{
$error="First Name cannot be empty";
}
else if (empty($Lname))
{
$error="Last Name cannot be empty";
}
else if (empty($gender))
{
$error="Gender cannot be empty";
}
else if (empty($food))
{
$error="Food cannot be empty";
}
else if (empty($quote))
{
$error="Quote cannot be empty";
}
else if (empty($education))
{
$error="Education cannot be empty";
}
else if (empty($TofD))
{
$error="Favorite time cannot be empty";
}
if($error==NULL)
{
$data="";
$data=implode(",",$food);
$query="insert into form values('','$Fname','$Lname','$gender','$data','$quote','$education','$TofD')";
$result=mysql_query($query);
if($result)
{
$succes = "Succesfuly added your information";
}
?>
}
else
{
?>
}
}
?>
*/
Form.php
/*
echo $err=$_REQUEST['err'];
?>
echo $succes=$_REQUEST['succes'];
?>
*/