我有以下代码没有多大意义。
<td style='width: 233px'><?php
if (!empty($jobsprocesscompleteArr)){
echo CHtml::DropDownList("Jobsprocesscomplete[$i]lookupprocess_id",$jobsprocesscompleteArr[$i]->lookupprocess_id,$processstages,array('id'=>'Jobsprocesscomplete_'.$i.'_lookupprocess_id','style'=>'width:230px','onchange'=>'createjobprocesscomplete('.$item['JOBNO'].',this,'.$i.')'));
}else{
echo CHtml::activeHiddenField($jobsprocesscompleteempty,"[$i]JOBNO");
echo CHtml::DropDownList("Jobsprocesscomplete[$i]lookupprocess_id",0,$processstages,array('id'=>'Jobsprocesscomplete_'.$i.'_lookupprocess_id', 'style'=>'width:230px','onchange'=>'createjobprocesscomplete('.$item['JOBNO'].',this,'.$i.')' ) );
}
?>
</td>
<td class=th3>
<?php
if (!empty($jobsprocesscompleteArr)){
echo CHtml::activeHiddenField($jobsprocesscompleteArr[$i],"[$i]jobsprocesscomplete_id" , array('value'=>$jobsprocesscompleteArr[$i]->jobsprocesscomplete_id) );
echo CHtml::activeHiddenField($jobsprocesscompleteArr[$i],"[$i]JOBNO",array('value'=>$jobsprocesscompleteArr[$i]->JOBNO, 'id' => "Jobsprocesscomplete_".$i."_JOBNO"));
//echo CHtml::activeHiddenField($jobsprocesscompleteArr[$i],"[$i]JOBNO",array('value'=>$jobsprocesscompleteArr[$i]->JOBNO, 'id' => "Jobsprocesscomplete_".$i."_JOBNO"));
}
未提交下拉列表。模式Jobsprocesscomplete
的帖子结果如下。
Array ( [0] => Array ( [jobsprocesscomplete_id] => 1 [JOBNO] => 13013059 [datedone] => 2013-10-08 ) [1] => Array ( [jobsprocesscomplete_id] => 3 [JOBNO] => 13013305 [datedone] => 2013-02-19 00:00:00 ) [2] => Array ( [jobsprocesscomplete_id] => 5 [JOBNO] => 13013306 [datedone] => 2013-02-19 00:00:00 ) [3] => Array ( [jobsprocesscomplete_id] => 7 [JOBNO] => 13013307 [datedone] => 2013-02-19 00:00:00 ) [4] => Array ( [jobsprocesscomplete_id] => 9 [JOBNO] => 13013308 [datedone] => 2013-02-19 00:00:00 ) [5] => Array ( [datedone] => ) ) 1
最初,我在if语句中的下拉列表上方有两个隐藏字段,但没有出现在帖子中。当我将它们移动到下面td
时它出现在帖子中但是我无法移动下拉列表并且下拉列表没有出现在帖子中。我做错了什么?
HTML
以下是未在$_POSTS['Jobsprocessco mplete']
<td style="width: 233px">
<select id="Jobsprocesscomplete_0_lookupprocess_id" name="Jobsprocesscomplete[0]lookupprocess_id" onchange="createjobprocesscomplete(13022020,this,0)" style="width:230px">
<option value="533">25 NA</option>
<option value="13059">35 1st Pass Velocity Analysis</option>
<option value="13061">75 3rd Pass Velocity Analysis</option>
<option value="13063">100 DBS</option>
<option selected="selected" value="0">Select</option>
</select>
</td>
我必须输入一个隐藏字段并使用onchange
事件填充以将其传递到帖子
<td class="th3">
<input id="hidden_Jobsprocesscomplete_0_lookupprocess_id" type="hidden" name="Jobsprocesscomplete[0][lookupprocess_id]">
<input id="Jobsprocesscomplete_0_JOBNO" type="hidden" name="Jobsprocesscomplete[0][JOBNO]" value="13022020">
<input id="Jobsprocesscomplete_0_datedone" class="hasDatepicker" type="text" name="Jobsprocesscomplete[0][datedone]" style="width:80px;">
</td>
答案 0 :(得分:1)
我认为下拉列表的名称应为Jobsprocesscomplete[$i][lookupprocess_id]
,因为您正在执行数组。该值应存储到$_POST['Jobsprocesscomplete'][0]['lookupprocess_id']