<?php session_start();?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Process</title>
</head>
<body>
<?php
if(isset($_POST['add']))
{
//Make Connection
require_once("./include/mysql_connect.php");
//Make Query
$query = "INSERT INTO contacts (name, email, telephone, office, nickname) VALUES ('$name','$email','$phone','$office', '$nickname')";
$result = @mysql_query($query); //run the query
if ($result)
{
//it ran okay
echo '<h1>Thank You!</h1>';
$_SESSION['email']=NULL;
$_SESSION['name']=NULL;
$_SESSION['phone']=NULL;
$_SESSION['office']=NULL;
$_SESSION['nickname']=NULL;
session_unset(); //unsets session variables
session_destroy(); //destorys session
exit();
}
else
{
//it did not run okay
echo '<h1>System Error</h1>You could not be registered due to a system error';
echo '<p>' .mysql_error() . '<br /><br />Query: ' . $query . ' </p>'; //debug message
exit();
}
//close connection
mysql_close();
}
?>
</body>
</html>