0
votes

In my data base, I have monday_open, monday_close... sunday_close columns

I am trying to implement a submit form where you are able to select open time and close time and just checkoff which day that time belongs to and it will save it to the database accordingly

Basically I am trying to eliminate choosing same store hours for all days

can anyone help me with this problem?

Thank you so much!

e.g. form view

open_time: 9:00 ~ close_time: 16:00

Monday[o] Tuesday[o] Wednesday[o] Thursday[] Friday[] Saturday[] Sunday[]

backend(DB)

monday_open|monday_close|Tuesday_open|...

9:00am | 16:00 |9:00am

It will get saved something like above example

1

1 Answers

0
votes

Your table is not normalised. If you have the means, change columns to:

__________________________________
| Day | Open | Close | Store_ID? |
|-----|------|-------|-----------|
| 0   | 8:00 | 17:00 | 2         |
| 1   | 9:00 | 18:00 | 2         |
----------------------------------

Look at Date::DAYNAMES for the text of the day

That way you can make association between the store and the hours. Adding checkbox would be very easy from there