I am VERY new to PHP & mySQL. I have a form on my page. This form has fields for a few things. Upon entering this information and hitting the submit button, the for dissappears and the the user is informed that the information has been added. I did this with a simple echo. The information is being added to mySQL. My question is this:
After the echo text is displayed, how do I go about returning to the home page? I have tried a lot of things last night, but have had no luck.
Here is my code:
<?php
$dbh=mysql_connect ("localhost", "*****", "*****") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("customde_UserAccount");
if (! @mysql_select_db("*****") ) {
echo( "<P>Unable to locate the information " .
"database at this time.</P>" );
exit();
}
?>
<html>
<head>
<title>MySQL Submission Test</title>
</head>
<body>
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post">
<center><input type="text" name="user_name"></center>
<center>Username</center>
<center> <input type="text" name="password"></center>
<center>Password</center>
<center><input type="submit" name="submit" value="Submit!"></center>
</form>
<?php
} else {
$user_name = $_POST['user_name'];
$password = $_POST['password'];
$create_date = date('Y/m/d');
$create_time = date('H:i:s');
mysql_query("INSERT INTO `Valid_User` (user_name, password, create_date, create_time) VALUES ('$user_name', '$password', '$create_date', '$create_time')");
echo "Your request has been added!";
}
?>
</body>
</html>
Thank you in advance for your help!