Setare valori din array in select tag
Scris: Mar Apr 13, 2021
Salut am un array cu orele de functionare
si am doua butone de selectare ora de deschidere si ora de inchidere a programului
pot sa fac in asa fel in cat sa fie ora de deschidere predefinita la 9:00AM si ora de inchidere la 6:30PM si in al doilea buton select ora pe care pot sa o aleg sa fie mai mare decat ora de deschidere??
Cod: Selectaţi tot
$data['times'] = array (
'0400' => '04:00 AM',
'0430' => '04:30 AM',
'0500' => '05:00 AM',
'0530' => '05:30 AM',
'0600' => '06:00 AM',
'0630' => '06:30 AM',
'0700' => '07:00 AM',
'0730' => '07:30 AM',
'0800' => '08:00 AM',
'0830' => '08:30 AM',
'0900' => '09:00 AM',
'1800' => '06:00 PM',
'1830' => '06:30 PM',
'1900' => '07:00 PM',
'1930' => '07:30 PM',
'2000' => '08:00 PM',
'2030' => '08:30 PM',
'2100' => '09:00 PM',
'2130' => '09:30 PM',
'2200' => '10:00 PM',
'2230' => '10:30 PM',
'2300' => '11:00 PM',
'2330' => '11:30 PM',
);
Cod: Selectaţi tot
<table class="table table-bordered table-hover">
<thead>
<tr class="panel-heading">
<td style="text-align: left">{{ text_day }}</td>
<td style="text-align: left">{{ text_open }}</td>
<td style="text-align: left">{{ text_close }}</td>
</tr>
</thead>
<tbody>
<tr>
<td>
<label class="col-sm-2 control-label" >{{zi_01}}</label>
</td>
<td>
<label for="input-open-luni{{location.location_id}}"></label>
<select name="shipping_pickup_location_open_luni{{location.location_id}}" id="input-open-luni{{location.location_id}}" class="form-control">
{% for cod,name in times %}
{% if shipping_pickup_location_open_luni[location.location_id] == cod %}
<option value="{{cod}}" selected="selected"> {{name}}</option>
{% else %}
<option value="{{cod}}" >{{name}}</option>
{% endif %}
{% endfor %}
</select>
</td>
<td>
<label for="input-close-luni{{location.location_id}}"></label>
<select name="shipping_pickup_location_close_luni{{location.location_id}}" id="input-close-luni{{location.location_id}}" class="form-control">
{% for cod,name in times %}
{% if shipping_pickup_location_close_luni[location.location_id] == cod %}
<option value="{{cod}}" selected="selected"> {{name}}</option>
{% else %}
<option value="{{cod}}" >{{name}}</option>
{% endif %}
{% endfor %}
</select>
</td>
</tr>
</tbody>
</table>