您好我在PHP框架Codeigniter中有一个带有选择器名称“top”的表单。当我提交表单时,输入帖子不显示发布的值。只有当我第二次提交时,才会发布价值。代码如下,请指教?
<div id="selector_form">
<?php
echo form_open(base_url().'home/choose_car/'); ?>
<select name="select_car">
<option>Please Select Car</option>
<?php
foreach ($list as $key => $value) {
if($value->model == $car[0]->model){
$selected = 'selected';
}else{
$selected = '';
}
//change make to carid
echo "<option ".$selected." value='".$value->carID."''>".$value->make." - ".$value->model."</option>";
}
?>
</select>
<textarea id="description" rows="4" cols="50" ><?php if(isset($car)&&$car){print_r($car[0]->desc);}else{echo "Please Select Car";} ?></textarea>
<input type="submit" />
</div><!-- end selector_form -->
<table id="controls_table">
<th>Section</th><th>Material</th><th>Color</th><th>Show</th>
<tr>
<td><label for="top">Top: </label></td>
<td><select name="top">
<?php
if($material){
foreach ($material as $key => $value) {
if($value->materialID == $this->input->post('top')){
$selected = 'selected';
}else{
$selected = '';
}
echo "<option ".$selected." value='".$value->materialID."'>Carbon/".$value->materialName."</option>";
}
}else{
echo "<option ".$selected." >Please Select Car</option>";
}
?>
</select></td>