public function update_assetrep()
{
$checkedRep=$_POST['checkedRep'];
$data['astrep']=$this->asset_model->get_astrep($checkedRep);
$data['rep_options']=array_column($this->data['rep_logo'],'f_name','id' );
$this->load->view('asset/asset_rep',$data);
//$this->load->view('script/assets_script');
}
<div class="form-group">
<div class="row">
<div class="col-md-5">
<div class="input-group">
<?
foreach($astrep as $astrep_detail)
{?>
<input type="hidden" name="astid" id="astid" class="form-control" value="<?=$astrep_detail['id']?>" style="width:225px;border-radius: 3px;"/>
<? }
?>
</div>
</div>
</div>
</div>
这里我有一个从表中获取值的代码,但它显示在单独的文本框中。我想要所有的文本框值。但我在控制器中只得到最后一个输入框值。谁能告诉我吗?如有帮助,我们将不胜感激。
Try to change your input from:
<input type="hidden" name="astid" id="astid" class="form-control" value="<?=$astrep_detail['id']?>" style="width:225px;border-radius: 3px;"/>
To
<input type="hidden" name="astid[]" class="form-control" value="<?=$astrep_detail['id']?>" style="width:225px;border-radius: 3px;"/>
and receive same in controller as:
if(isset($_POST['astid'])){
foreach($_POST['astid'] as $key => $data)
{
print '<pre>';
var_dump($data);
}
}