warpdesign Posted September 8, 2006 Share Posted September 8, 2006 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 https://forums.phpfreaks.com/topic/20134-need-advice-on-date-input/ Share on other sites More sharing options...
pgsjoe Posted September 8, 2006 Share Posted September 8, 2006 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 https://forums.phpfreaks.com/topic/20134-need-advice-on-date-input/#findComment-88517 Share on other sites More sharing options...
AndyB Posted September 8, 2006 Share Posted September 8, 2006 http://www.rainforestnet.com/datetimepicker.htmThat 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 https://forums.phpfreaks.com/topic/20134-need-advice-on-date-input/#findComment-88523 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.