我正在使用laravel框架。我很困惑如何显示选择下拉数据,同时在这里编辑一些数据是我的方案: -
在这里你可以看到星期一被选中,但我想选择星期一的第一个下拉列表和周二的第二个下拉列表和周二的相同sa。 这是我的代码: -
enter code here
<?php $from =array("6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23");
$days = array("Monday", "Tuesday", "Wednesday", "Thursday","Friday","Saturday","Sunday"); ?>
<?php if(!empty($fitness['days'])){
$selectdays = explode(',', $fitness['days']);
}
if(!empty($fitness['from'])){
$start = explode(',', $fitness['from']);
echo "<pre>"; print_r($start); die;
}
if(!empty($fitness['to'])){
$end = explode(',', $fitness['to']);
echo "<pre>"; print_r($start); die;
}
?>
<div class="col-md-12 col-sm-12 col-xs-12 fitness-time">
<div class="row">
<div class="additional">
<div class="form-group">
<span class="fitness-hours">
<h4>Opening Hours</h4>
</span>
<div>
<div class="info_user_detail">
<table class="table_info1 table-striped table-error">
@foreach($days as $key=> $alldays)
<?php if(!empty($fitness['days'])){
if(in_array($alldays, $selectdays)){
$checked = "checked";
}else{
$checked = "";
}
}else{
$checked = "";
} ?>
<tr>
<td>
<div class="checkbox no-margin">
<label>
<input class="days" name="days[]" value="{{ $alldays }}" type="checkbox" <?php echo $checked; ?>>{{ $alldays }}
</label>
</div>
</td>
<td>
<div class="time-class">
<select name="from[]"class="select-class from">
<option value="">Select</option>
@foreach($from as $key=> $froms)
<?php if($key <= 6 ){
if(in_array($froms,$start)){
$selected = "selected";
} else{
$selected = "";
}
} ?>
<option value="{{ $froms }}" <?php echo $selected;?>> {{ $froms}}</option>
@endforeach
</select>
</div>
</td>
<td>
<div class="time-class">
<select name="to[]"class="select-class to">
<option value="">Select</option>
</select>
</div>
</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
</div>
</div>
</div>
我希望在星期一被选中时显示19在第一个下拉菜单中被选中 第二次下拉中23次,周二同样下降。请帮帮我