I am having a problem with some code I wrote I hope the title makes sense. I am trying to insert peoples names and age into a table I made. I have been over my code lots of times and can not find out what is wrong with it. Is there something wrong with the code I wrote or is it something else? The connection to the server is not the problem. Thanks for reading
<html>
<head>
</head>
<body>
<form action="insertforrm.php" method="post">
First Name:<input type="text" name= "first"><br/>
Last Name: <input type ="text" name= "last"><br/>
Age <input type= "text" name="age"><br/>
<input type="submit" name="submit">
</form>
<?php
if (isset($_POST['submit'])) {
$con = mysql_connect("localhost" , "root" , "root");
if (!$con) {
die("cant covnnect:" . mysql_error());
}
mysql_select_db("names",$con);
$sql = "INSERT INTO jack (First,Last,Age) VALUES ('$_POST[first]','$_POST[last]','$_POST[age]')";
mysql_query ($sql,$con);
mysql_close ($con);
}
?>
</body>
</html>