Here is mySQL view:
And then here is my code:
<html>
<head>
</head>
<body>
<form action="formwrite.php" method="post">
Description:<input type="text" name="description"><br/>
Material:<input type="text" name="material"><br/>
Type:<input type="text" name="type"><br/>
Condition:<input type="text" name="condition"><br/>
Price:<input type="text" name="price"><br/>
<input type="submit" name="submit">
</form>
<?php
if(isset($_POST['submit'])){
$con=mysql_connect("localhost", "mysql", "test1");
if (!$con) {
die ("Can not connect:". mysql_error() );
}
mysql_select_db("owenp",$con);
$sql="INSERT INTO items(material,type,date,condition,price,description) VALUES('$_POST[material]','$_POST[type]',now(),'$_POST[condition]','$_POST[price]','$_POST[description]')";
mysql_query($sql,$con);
mysql_close($con);
}
?>
</body>
</html>
The problem that I'm experiencing is that the PHP runs without any errors but a record will not be created in my database. I have checked many times and everything points to the right place i.e. username and database/table names.
Thank in advance for any help.