我有带有选项的表单,当我想添加时,值为空。 我想问的是如何获得我选择的值?
我的表格:
<select name="student_id" class="form-control" data-validate="required" id="student_id"
data-message-required="<?php echo get_phrase('value_required');?>"
onchange="return get_class_sections(this.value)">
<option value=""><?php echo get_phrase('Selectează_un_student');?></option>
<?php
$stare='0';
$classes = $this->db->get_where('disertatie_studenti',array('retrasi'=>$stare))->result_array();
foreach($classes as $row):
?>
<option value="<?php echo $this->db->get_where('disertatie_studenti' , array('student_id' => $row['student_id']))->row()->name;?>">
<?php echo $row['name'];?>
</option>
<?php
endforeach;
?>
</select>
我的控制器
$data['student_id'] = $this->input->post("student_id");
错误信息:
INSERT INTO `disertatie_corectura` (`student_id`, `corectura`, `timestamp`, `year`) VALUES (NULL, '2554', 1574456889, '2019-2020')
<option value="<?php echo $this->db->get_where('disertatie_studenti' , array('name' => $row['name']))->row()->student_id;?>">
<?php echo $row['name'];?>