Page 1 of 1

HTML form field to enter dates into mySQL database

Posted: Fri Oct 24, 2008 11:40 am
by steve_linn
New programmer -
building a HTML form to enter info into a MySQL database.

what is the best way to get dates in the database?

I was thinking about 3 select fields with months, year, date options

Is there a better way?

what PHP code do I need to convert those fields into a format that MySQL datetime likes?

thanks!

Re: HTML form field to enter dates into mySQL database

Posted: Fri Oct 24, 2008 2:17 pm
by jaoudestudios
3 drop downs are fine.

If you want to make it more user friendly why not use a calendar with jquery.

Both methods will return a date in a similar format... 23/10/2008 or 2008/10/23.

I would store this in the database as a MySql timestamp or a unix timestamp (preferably the former).

Choose a method then we can help you with specifics.

Re: HTML form field to enter dates into mySQL database

Posted: Fri Oct 24, 2008 3:51 pm
by steve_linn
thanks for your assistance!