i have created a html form page(1) and php page(2) to insert records into a database from the html form,
when i insert the records from the html form and press the submit button the records don't get into the database but a page open with the php code i have wrote,and if i opened the php page or refresh it an empty records get added to my database,here is my html and php code:
html code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="asdasdas" />
<title>informations</title>
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data" >
Full Name<input type="text" name="fullname" /><br />
Father Name<input type="text" name="fname" /><br />
Birth Where/When<input type="text" name="birth" /><br />
<input type="submit" value="save" name="submit" />
</form>
</body>
</html>
php code:
<?php
/**
* @author 00092
* @copyright 2011
*/
extract($_REQUEST);
$con = mysql_connect("localhost", "root", "pass");
if (!$con) {
die('could not connect:' . mysql_error());
}
mysql_select_db("info", $con);
$sql = "insert into `reference` (`fullname`,`fname`,`birth`)
values ('$_post[fullname]','$_post[fname]','$_post[birth]')";
if (mysql_query($sql, $con)) {
echo "Done";
} else {
}
mysql_close($con);
?>
note:each one in a different page,am using a localhost server ,i mean it's not online.