Hi Again,
Yet another problem.
I am trying to input a date into mySQL database from a PHP Form.
What ever format i write the date in
14/01/2011
14-01-2011
2011-01-14
i always get the following input
0000-00-00
How do i solve this, so that the inputted date is what is passed to the database
book1.htm
<html>
<body>
<form action="book1.php" method="post"><br>
Username: <input type="text" name="User" /><br>
Horse: <input type="text" name="Horse" /><br>
Day:<input type="text" name="Day" /><br>
Month:<input type="text" name="Month" /><br>
Year:<input type="text" name="Year" /><br>
Date:<input type="text" name="Date" /><br>
Notes: <input type="text" name="Notes" /><br>
<br>
<br>
<br>
<input type="submit" />
</form>
</body>
</html>
book1.php
<?php
$con = mysql_connect("DELETED","DELETED","DELETED");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DELETED", $con);
$sql="INSERT INTO Booking (User, Horse, Day, Month, Year, Date, Notes)
VALUES
('$_POST[User]','$_POST[Horse]','$_POST[Day]','$_POST[Month]','$_POST[Year]','$_POST[Date]','$_POST[Notes]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>