Jump to content

Days/Hours of operation user input


amclean

Recommended Posts

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

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".

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.