If my question has been answered in another post, please accept my apologies and direct me to said post.
My problem is that I have a database that I'm trying to add data into using a simple form. When I fill in the form and hit my Submit button...nothing happens beyond the form fields clearing themselves. After hitting Submit, I pull up the database in phpMyadmin and there is no new data to be seen anywhere.
Here's the code for the form page:
Code: Select all
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RMVD</title>
</head>
<body>
<form id="contacts" name="contacts" method="post" action"contacts_insert.php">
<p>Parent's First Name:
<input name="first" type="varchar" id="first" />
</p>
<p>Parent's Last Name:
<input name="last" type="varchar" id="last" />
</p>
<p>Second Parent's First Name:
<input name="first2" type="varchar" id="first2" />
</p>
<p>Parent's Last Name:
<input name="last2" type="varchar" id="last2" />
</p>
<p>Home Phone:
<input name="homephone" type="varchar" id="homephone" />
</p>
<p>Cell Phone:
<input name="cellphone" type="varchar" id="cellphone" />
</p>
<p>Work Phone:
<input name="workphone" type="varchar" id="workphone" />
</p>
<p>E-Mail Address:
<input name="email" type="varchar" id="email" />
</p>
<input type="submit" name="Submit" value="Submit" />
</form>
</body>
</html>
Code: Select all
<?php
$host="***removed***";
$user="***removed***";
$password="***removed***";
$database="contacts";
mysql_connect($host,$user,$password)or die("Can not connect DB");
@mysql_select_db($database) or die( "Unable to select database");
$first=$_POST['first'];
$last=$_POST['last'];
$first2=$_POST['first2'];
$last2=$_POST['last2'];
$homephone=$_POST['homephone'];
$cellphone=$_POST['cellphone'];
$workphone=$_POST['workphone'];
$email=$_POST['email'];
mysql_query("INSERT INTO contacts(first, last, first2, last2, homephone, cellphone, workphone, email) values('$first','$last','$first2','$last2','$homephone','$cellphone','$workphone','$email')");
mysql_close();
?>