<?
$name=$_POST['name'];
$email=$_POST['email'];
$location=$_POST['location'];
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
mysql_select_db("Database_Name") or die(mysql_error());
mysql_query("INSERT INTO `data` VALUES ('$name', '$email', '$location')");
Print "Your information has been successfully added to the database.";
?>
As you can see the first thing we do is assign variables to the data from the previous page. We then just query the database to add this new information.
Of course before we try it we need to make sure the table actually exists. Executing this code should create a table that can be used with our sample files:
CREATE TABLE data (name VARCHAR(30), email VARCHAR(30), location VARCHAR(30));

