MySQL Problem Inserting
Posted: Wed Nov 19, 2008 10:12 pm
I have a script that users fill out a simple form > it inserts into the database, but one field is not submitting
and that is the date. The date is just submitting into the database as 00-00-0000
The text box on the HTML form tells the user to submit the date as MM-DD-YYYY
And (Im the only one testing out the script right now, but I figured Id make it work before it goes live)
Does anyone know why its submitting the date like that. In PHPMyAdmin I have selected as "Date" for that field.
Here is the script that inserts the values:
and that is the date. The date is just submitting into the database as 00-00-0000
The text box on the HTML form tells the user to submit the date as MM-DD-YYYY
And (Im the only one testing out the script right now, but I figured Id make it work before it goes live)
Does anyone know why its submitting the date like that. In PHPMyAdmin I have selected as "Date" for that field.
Here is the script that inserts the values:
Code: Select all
<?php
$con = mysql_connect("","l","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("legion", $con);
$sql="INSERT INTO cadet_events (eventname, eventdate, eventdescription)
VALUES
('$_POST[eventname]','$_POST[eventdate]','$_POST[eventdescription]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "The Event Has Been Added - Thank You";
mysql_close($con)
?>