What should be done with low-frequency option options?

often encounter such problems, such as the development of a reservation function, the appointment time can be selected, such as

<select id="appointment-time">
    <option value="21">8:00-10:00</option>
    <option value="22">10:00-12:00</option>
    <option value="23">12:00-14:00</option>
    <option value="24">14:00-16:00</option>
    <option value="25">16:00-18:00</option>
    <option value="26">18:00-20:00</option>
    <option value="27">20:00-22:00</option>                                                        
</select>
Php
Mar.07,2021

just write a configuration file at the front end

const time = [
    {text: '8:00-10:00', value: 21 }
    ...
]

for loop
this should be agreed upon by the front and back end, that is, the agreement is greater than the configuration

.
  1. from the point of view of facilitating future maintenance, it is worthwhile to store this data exclusively.
  2. as for storage, you can use tables or configuration files; you can store one file at a time, or you can store a pile of data together.
Menu