Hi Everyone,
I have a form that submits data into a database with the use of PHP. I have a hidden form element that I created in order to input the current date and time into the database using the now() function once the form has been submitted (i'm using MySQL). The problem i'm experiencing is when the form has been submitted and the necessary form data is placed into the database, the datetime field is set to zeros instead of the current date and time - it displays 0000-00-00 00:00:00.
Input field looks like this...
The corresponding PHP code that deals with this specific control is the following...
The PHP code above i took out of the VALUES part of the SQL query. I know something is being sent to the datetime field in the database because it displays a series of zeros, I'm just not sure why it doesn't accept the current time and date from the now() function. When i enter the following query...
the above works, it updates the datetime field with the current date and time. So at least the now() function does input the correct data.
Any idea what I'm doing wrong?
Thanks for your time,
- CK