<form action="script.php">
Name: <input type="text" name="Name"><br>
Email: <input type="text" name="Email">
<input type="submit" name="submit" value="submit">
</form>
<?
$host = "localhost";
$login_name = "root";
$password = "*****";
//Connecting to MYSQL
MySQL_connect("$host","$login_name","$password");
//Select the database we want to use
MySQL_select_db("test") or die("Could not select database");
//Assign contents of form to variables
$name = $POST['Name'];
$email = $POST['Email'];
$sql = "INSERT INTO test SET"
Email = "$email",
First_Name = "$name"
");
$result = mysql_query($sql);
//Code to check if statement executed properly and display message
if ($result) {
echo("Email and Name successully added");
} else {
echo("An error has occured");
}
//Close connection with MySQL
MySQL_close()
?>