Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript codeigniter表单以提交选定的下拉列表值_Javascript_Php_Jquery_Forms_Codeigniter - Fatal编程技术网

Javascript codeigniter表单以提交选定的下拉列表值

Javascript codeigniter表单以提交选定的下拉列表值,javascript,php,jquery,forms,codeigniter,Javascript,Php,Jquery,Forms,Codeigniter,我需要做一个表格,有一个下拉选择记录,当点击提交按钮可以编辑。 一切正常,只是按钮没有获得选定的id 这是我表格的截图: 视图: input->post(); $lista=$this->instrumento\u model->get\u instrumento($instrumento\u id); $html=“”; foreach($lista为$k=>$v){ $html.=''.$v['instrumento_nome'].'; } echo$html; } 函数编辑工具($in

我需要做一个表格,有一个下拉选择记录,当点击提交按钮可以编辑。 一切正常,只是按钮没有获得选定的id

这是我表格的截图:

视图:



控制器:
public function instrumento($instrumento\u id){
$posts=$this->input->post();
$lista=$this->instrumento\u model->get\u instrumento($instrumento\u id);
$html=“”;
foreach($lista为$k=>$v){
$html.=''.$v['instrumento_nome'].';
}
echo$html;
}
函数编辑工具($instrumento\u id){
$data['success']=0;
如果(美元邮政){
$data\u post=数组(
'user_id'=>$\u POST['nome'],
'instrumento_nome'=>$\u POST['instrumento_nome']
);
$this->instrumento\u model->update\u instrumento($instrumento\u id,$data\u post);
$data['success']=1;
$this->load->view('admin/edit_instrumento',$data);
重定向(base_url().“admin/h”);
}
$data['instrumento']=$this->instrumento\u model->get\u instrumento($instrumento\u id);
$this->load->view('admin/edit_instrumento',$data);
}
型号: 函数get_instrumentos(){ $this->db->select('*'); $this->db->from('instrumentos'); $this->db->join(“users”,“users.user\u id=instrumentos.user\u id”,“inner”); $query=$this->db->get(); 返回$query->result_array(); } 函数get\u instrumento($instrumento\u id){ $this->db->select()->from('instrumentos')->where(数组('instrumento_id'=>$instrumento_id)); $query=$this->db->get(); 返回$query->first_行('array'); } 函数更新\u instrumento($instrumento\u id,$data){ $this->db->where('instrumento\u id',$instrumento\u id); $this->db->update('instrumentos',$data); }
您使用了错误的post值

查看其
标签

<select class="uni_style" name="tag" id="tag_drop" >
这是错误的,在两个地方使用相同的名称

解决方案

或者在视图中更改名称

name="instrumento_nome" and in controller use as $_POST['instrumento_nome']

or 

name="tag" and in controller use as $_POST['tag']

你拿错了帖子的价值

查看其
标签

<select class="uni_style" name="tag" id="tag_drop" >
这是错误的,在两个地方使用相同的名称

解决方案

或者在视图中更改名称

name="instrumento_nome" and in controller use as $_POST['instrumento_nome']

or 

name="tag" and in controller use as $_POST['tag']

嗨,是的,我只是尝试过,但是它不起作用,你能认为它是工具吗?因为它甚至不起作用。问题是Editar底部无法获取我选择的instrumento_id。这两个位置都有更改吗??在视图和控制器中??是的,下拉菜单已经使用JS获取了他的数据,因此没有问题。我需要的是,在从下拉列表中选择并按下底部的“editar”后,我可以编辑其他表单。我始终使用foreach使用一个表,并可以添加一个底部进行编辑。但在这种情况下,我做的不同。。。想要一个下拉,当我选择这个选项,按下“否”按钮可以转到另一个窗体来编辑它。第二个下拉是来自Ajax??嗨,是的,我只是Trimg,但是它不起作用,你能认为它是工具吗?因为它甚至不起作用。问题是Editar底部无法获取我选择的instrumento_id。这两个位置都有更改吗??在视图和控制器中??是的,下拉菜单已经使用JS获取了他的数据,因此没有问题。我需要的是,在从下拉列表中选择并按下底部的“editar”后,我可以编辑其他表单。我始终使用foreach使用一个表,并可以添加一个底部进行编辑。但在这种情况下,我做的不同。。。想要一个下拉列表,当我选择该选项并按“否”时,botton可以转到另一个表单进行编辑。第二个下拉列表是来自ajax吗??