PHP Form | Time Input

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FoolishThinker
Forum Newbie
Posts: 2
Joined: Tue Jun 30, 2009 7:33 pm
Location: Manila, Philippines
Contact:

PHP Form | Time Input

Post by FoolishThinker »

Hi. I am trying to create a form that would allow users to enter time (e.g. 3:36 PM) on a text field. I need the users to enter it in a 12 hour format and indicate whether its AM or PM. Can someone please teach me how to do this or tell me a good way to code this in php? I'd really appreciate it. :D
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP Form | Time Input

Post by califdon »

FoolishThinker wrote:Hi. I am trying to create a form that would allow users to enter time (e.g. 3:36 PM) on a text field. I need the users to enter it in a 12 hour format and indicate whether its AM or PM. Can someone please teach me how to do this or tell me a good way to code this in php? I'd really appreciate it. :D
I would recommend using 3 separate select elements so that you get reliable data.

Code: Select all

+-----+-+   +------+-+   +------+-+
|  1  |V| : |  00  |V|   |  AM  |V|
+-----+-+   +------+-+   +------+-+
FoolishThinker
Forum Newbie
Posts: 2
Joined: Tue Jun 30, 2009 7:33 pm
Location: Manila, Philippines
Contact:

Re: PHP Form | Time Input

Post by FoolishThinker »

thanks a lot for the idea! :D
Post Reply