amclean Posted October 13, 2008 Share Posted October 13, 2008 I'm trying to create what you might call a storefront, and I need the businesses to be able to input their days/hours of operation, like "Mon-Fri 9-5, Sat 10-4, Sun Closed" os something like that - definitely not married to that format. The output will be put in one form or another into a mysql db. I've been racking my brain for days trying to come up with a solution but I can't seem to come up with anything that looks remotely clean. Any suggestions? Link to comment https://forums.phpfreaks.com/topic/128278-dayshours-of-operation-user-input/ Share on other sites More sharing options...
F1Fan Posted October 13, 2008 Share Posted October 13, 2008 Could you explain a little further? Are multiple businesses going to enter open/close times? Are you looking for PHP help, or help setting up your table? Link to comment https://forums.phpfreaks.com/topic/128278-dayshours-of-operation-user-input/#findComment-664463 Share on other sites More sharing options...
amclean Posted October 13, 2008 Author Share Posted October 13, 2008 Thanks for replying. Sorry for not providing enough info. Yes, multiple businesses will enter the open/close times. I'm hoping to find a php solution. The DB I'll figure out later but should be much easier. As a last resort I can always just put in a text field but i was hoping for a simpler standardized way of doing it so i don't have to rely on dimwits knowing how to spell things like "Wednesday". Link to comment https://forums.phpfreaks.com/topic/128278-dayshours-of-operation-user-input/#findComment-664469 Share on other sites More sharing options...
F1Fan Posted October 13, 2008 Share Posted October 13, 2008 I suggest using a standard time format for the open and close time, and use PHP's date('w') function. That will return 0 for Sunday through 6 for Saturday. Then, don't let them "enter" a day, make them "select" one using a drop-down list. Or, just have 7 sections, one for each day, where they select an open and close time, or select "closed" if they are closed on that day. If you can get away with using select boxes rather than text, you'll reduce the possibilities for errors. For the DB table, it may be best to have a column for each day's open and another for each day's close times. That would be 14 columns, but it would make it easy to fetch. Link to comment https://forums.phpfreaks.com/topic/128278-dayshours-of-operation-user-input/#findComment-664475 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.