插入多个相同字段名称codeigniter



<input name="fldWorkHistoryCompanyName[]" type="text" class="form-control" placeholder="1023456789" value="">
<input name="fldWorkHistoryCompanyName[]" type="text" class="form-control" placeholder="1023456789" value="">
<input name="fldWorkHistoryCompanyName[]" type="text" class="form-control" placeholder="1023456789" value="">
<input name="fldWorkHistoryCompanyName[]" type="text" class="form-control" placeholder="1023456789" value="">

**如何使用codeigniter*插入此值

超全局$_POST['fldWorkHistoryCompanyName']将是一个数组,其中每个值都是文本输入的内容。捕获阵列并在其中循环执行您需要执行的操作。

$names = $this->input->post('fldWorkHistoryCompanyName');
foreach ($names as $name)
{
if(empty($name))
{
// whatever you need to do when no data was sent
// if you want to ignore empty inputs then all you need is
continue;
}
else
{
//save $name to the database
}

相关内容

  • 没有找到相关文章

最新更新