Forums

This topic is locked

submit button code

Posted 07 Jul 2007 01:59:44
1
has voted
07 Jul 2007 01:59:44 Robert Hansen posted:
Hi, I am very new to php and mysql so I am hoping someone can help. I have created a registration form and would like a simple way for the current date to be submitted with the form to the database when the registrant clicks on the submit button. Can someone point me in the right direction?

Thanks in advance

Replies

Replied 07 Jul 2007 13:01:12
07 Jul 2007 13:01:12 jeff winkler replied:
Use the Vb code as your default value in the field

<%=Now() %>
Replied 09 Jul 2007 20:16:04
09 Jul 2007 20:16:04 Robert Hansen replied:
Thanks for the help. When I use that code and hit the submit button I get the following message:

Incorrect date value: '' for column 'SUBMIT_DATE' at row 1

What I did was set up a hidden field in my form for my 'submit_date' field and then made the default value <%=now()%>. Is this not what you ment?
Replied 23 Jul 2007 12:24:35
23 Jul 2007 12:24:35 Patrick Woldberg replied:
use <?php echo date("F j, Y, g:i a"; ?> as default value, the above given sample was for ASP, not PHP. You can change the date formatting, check www.php.net/manual/en/function.date.php on how to change it.

--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Administrator at DMXzone.com, FLzone.net, FWzone.net and DNzone.com
--------------------------------------------------
Replied 21 Aug 2007 14:38:12
21 Aug 2007 14:38:12 rob hewitt replied:
Why not add a timestamp field to your table in MySQL so the date is automatically set when the insert is done from the form?

You wont have to include a hidden field in your form or add any additional page. When the record is inserted the timestamp will be created.

Reply to this topic