Using a form I am adding some basic fields to my table.
I also want to add the current date the data from the form is posted.
Any suggestions on how to do this would be appreciated.
Thanks.
$sql="INSERT INTO Experiments(Author, Title, Description)
VALUES
('$_POST[author]','$_POST[title]','$_POST[description]')";
if (!mysql_query($sql,$connection))
{
die('Error: ' . mysql_error());
}
header('Location: http://example.com');
You don’t need to enter it with PHP. Add a
TIMESTAMPcolumn to your table and set its default value toCURRENT_TIMESTAMP:Oh, and please sanitize your data entry!