我想重新填充文本项,插入后显示空值
<input type="number" id="primaryincome1" min="1" max="999" name="noc[]"
value="<?php echo (!isset($student1['noc'])) ? 0 : $student1['noc'] ?>" >
<input type="number" id="primaryincome2" min="1" max="999" name="noc[]"
value="<?php echo (!isset($student2['noc'])) ? 0 : $student2['noc'] ?>">
<input type="number" id="primaryincome3" min="1" max="999" name="noc[]"
value="<?php echo (!isset($student3['noc'])) ? 0 : $student2['noc'] ?>" >
<input type="number" id="primaryincom4" min="1" max="999" name="noc[]"
value="<?php echo (!isset($student4['noc'])) ? 0 : $student2['noc'] ?>" >
<input type="number" id="primaryincome5" min="1" max="999" name="noc[]"
value="<?php echo (!isset($student5['noc'])) ? 0 : $student2['noc'] ?>" >
<input type="number" id="primaryincome6" min="1" max="999" name="noc[]"
value="<?php echo (!isset($student6['noc'])) ? 0 : $student2['noc'] ?>"
控制器:
$certids = $this->input->post('certid');
$nocs = $this->input- >post('noc');
$result = array();
foreach ($certids as $index=>$certid)
{
$result[] = $certid . '_' . $nocs[$index];
}
echo '<pre>';print_r($result);echo '</pre>';
在输入项中进行更改后,它会提供输出:
Array
(
[0] => 1_2
[1] => 2_2
[2] => 3_2
[3] => 4_2
[4] => 5_2
[5] => 6_2
[6] => 7_
)
仅插入第一个值。其余值插入为“ 0”; 我该如何解决这个错误?我需要帮助。