HTML form field to enter dates into mySQL database

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
steve_linn
Forum Newbie
Posts: 20
Joined: Thu Jul 10, 2008 1:10 pm

HTML form field to enter dates into mySQL database

Post 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!
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: HTML form field to enter dates into mySQL database

Post 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.
steve_linn
Forum Newbie
Posts: 20
Joined: Thu Jul 10, 2008 1:10 pm

Re: HTML form field to enter dates into mySQL database

Post by steve_linn »

thanks for your assistance!
Post Reply