Jump to content

Need advice on date input


warpdesign

Recommended Posts

I'm creating an appointment application that the user inputs the dates of events. I created the interface as pull down menus so there are seven pull downs like so:
-Day of week- -Month- -Day- -Year- @ -Hour- : -Min- -AM/PM-

The desired input would be something like Mon, Sep 18 2006 @ 10:30 AM.

So I have a two part question, 1) is there a way to check that the date is valid? For example if the user imputs Tue, Sep 18 2006 and Sep 18 2006 is actually a Monday it should return an error. 2) is there a better way to get date input from the user? Seems like there should be some kind of calendar or something they can click on to ensure that they can't enter an invalid date but I don't want to build something like that from scratch...

Link to comment
Share on other sites

As long as you have the day, date and year your user does not need to input the actual day. You can echo that information out of php.

I use day-month-year in seperate drop downs, then before inserting you can put it together and insert it into your database as a date.

[code]$date = $year.'-'.$month.'-'.$day;[/code]

Hope this helps, I've never answered anyone's question before.
Link to comment
Share on other sites

http://www.rainforestnet.com/datetimepicker.htm

That solves many of the problems about choosing non-existent dates and is much 'friendlier' to humans than a multiple set of dropdowns.  Then 'reformat' the input to match whatever you want in the database in the form you want it. Hint: store it as datetime so you can do sensible sorting afterward.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.