smy101 Posted December 14, 2006 Share Posted December 14, 2006 Could someone please show me the proper code to have a simple HTML/PHP form return the time and date the form was submitted for Central Time zone?I have a basic "feedback" form that I would like to also print out the exact date & time the form was submitted when it returns the rest of the information on the form.Thanks in advance for any help. Quote Link to comment https://forums.phpfreaks.com/topic/30610-making-a-form-return-datetime-info/ Share on other sites More sharing options...
trq Posted December 14, 2006 Share Posted December 14, 2006 Just insert a timestamp into the database allong with the feedback. eg;[code]INSERT INTO feedback (feedback,datetime) VALUES ('$feedback',NOW());[/code] Quote Link to comment https://forums.phpfreaks.com/topic/30610-making-a-form-return-datetime-info/#findComment-140950 Share on other sites More sharing options...
.josh Posted December 14, 2006 Share Posted December 14, 2006 ^ assumes that the server is in CST... Quote Link to comment https://forums.phpfreaks.com/topic/30610-making-a-form-return-datetime-info/#findComment-140951 Share on other sites More sharing options...
smy101 Posted December 14, 2006 Author Share Posted December 14, 2006 [quote author=thorpe link=topic=118574.msg484624#msg484624 date=1166081295]Just insert a timestamp into the database allong with the feedback. eg;[code]INSERT INTO feedback (feedback,datetime) VALUES ('$feedback',NOW());[/code][/quote]Thank you for such a quick response, but I'm confused on where you mean I should put that code.The form is not operating with a database. Upon submit, it simply emails me the returned values.Basically I have an HTML form which upon "Submit" uses the php script to gather the values and email them to me. Quote Link to comment https://forums.phpfreaks.com/topic/30610-making-a-form-return-datetime-info/#findComment-140952 Share on other sites More sharing options...
trq Posted December 14, 2006 Share Posted December 14, 2006 Well in that case you'll need to use the [url=http://php.net/date]date[/url]() function to create a timestamp and concatinate it into your message.And as CV so quickly pointed out, you'll also need to adjust it to your servers time vs CST.Post your code if you want more then a push. Quote Link to comment https://forums.phpfreaks.com/topic/30610-making-a-form-return-datetime-info/#findComment-140954 Share on other sites More sharing options...
.josh Posted December 14, 2006 Share Posted December 14, 2006 well..if you aren't storing any of this stuff in a database, and just wanting the time sent to you in your email, along with your other info..doesn't your email already have a timestamp already built in, for when you received the email? nonetheless, if you are wanting it to send in your email, look into php's [url=http://us3.php.net/time]time[/url] function. Quote Link to comment https://forums.phpfreaks.com/topic/30610-making-a-form-return-datetime-info/#findComment-140955 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.