简体   繁体   English

如何获得选定的选项值(codeigniter)

[英]How to get selected option value (codeigniter)

i have form with options, when i want to add, the value is null.我有带选项的表单,当我想添加时,值为空。 what i want to ask is how to get the value i've selected?我想问的是如何获得我选择的值?

my form:我的表格:

<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&#259;_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>

my controller我的控制器

$data['student_id']            = $this->input->post("student_id");

error message:错误信息:

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'];?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM