Date/Time

He has: 698 posts

Joined: Jul 2005

I feel really stupid for asking this because I feel like the answer is right under my nose, but I just can't seem to understand how to do this.

I am working on a form, and I would like it to automatically record the date and time that the form was submitted, but I can't find the code or whatever to do it.

When the form is submitted, the data is added to a MySQL table, so if there is a way to do it in the MySQL settings or something, that would be great. Thanks. Smiling

By the way, I know how to use the date() function, if that's part of it. Smiling

Kurtis

chrishirst's picture

He has: 379 posts

Joined: Apr 2005

use the MySQL now() function in the insert query.

INSERT INTO table timefield VALUES(now()) ;

or set the field to a TIMESTAMP type and it will be updated on insert.

Chris

Indifference will be the downfall of mankind, but who cares?
Venue Capacity Monitoring
Code Samples

He has: 698 posts

Joined: Jul 2005

Thank you. I knew it was right there. Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.