I ran this on Xamp 5.538. The name of the file is application.php. The form appears normally and I get no error messages. However, it does not insert data into the MYSQL database. So far I have only been trying to get the top portion of the form to work; once it does I fill in the rest in the code. My database is named employees; the table’s name is table1. It contains the following fields so far: First, last, mi, address, city, state, zip, phone, email, ss, dob, security I tryed to post the entire form but wasn't smart enough to figure out how to do it or maybe it's just that I hate puzzles. Please figure this out for me. I’ve come along way, but still have further to go. Thank You; Eric Here’s the code:
<?php
// Your database info
$db_host = 'localhost';
$db_user = 'root';
$db_pass = '""';
$db_name = 'employees';
if (!empty($_POST))
{
$con = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
if ($con‐>connect_error)
die('Connect Error (' . mysqli_connect_errno() . ') '.
mysqli_connect_error());
$sql = "INSERT INTO table1 (first, last, mi, address, city, state, zip, phone, email, ss, dob, security) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
if (!$stmt = $con‐>prepare($sql))
die('Query failed: (' . $con‐errno . ') ' . $con‐error);
if (!$stmt‐ >bind_param('ssi',$_POST['fist'],$_POST['last'],$_POST['mi'],$_POST['address'],$ _POST['city'],$_POST['state'],$_POST['zip'],$_POST['phone'],$_POST['email'],$_PO ST['ss'],$_POST['dob'],$_POST['security']))
die('Bind Param failed: (' . $con‐errno . ') ' . $con‐error);
if (!$stmt‐>execute())
die('Insert Error ' . $con‐>error);
echo "Record added";
$stmt‐>close();
$con‐>close();
}
?>