PHP/JavaScript未定义索引错误 [英] Php/javascript undefined index error
问题描述
当我在php中声明我的下拉列表时,我有一个未定义的索引
$ selectAction =''< select id ="compAction" name ="compAction" style ="font-size:12px" onChange ="actionSelect(),document.redemptionsForm.submit();">'';
foreach($ arr as $ option => $ item){
$ selectAction.="< option id =". $ item. " value =". $ item. ".
((($ compAction == $ item)?''selected'':''''). >" . $ item. </option> \ n";
}
$ selectAction.=</select>";
Hi,i have a undefined index when I declare my dropdown in php like this
$selectAction = ''<select id="compAction" name="compAction" style="font-size: 12px" onChange="actionSelect(),document.redemptionsForm.submit();">'';
foreach($arr as $option => $item){
$selectAction .= "<option id=''" . $item . "'' value=''" . $item . "'' " .
(($compAction == $item)?''selected'':'' '') . ">" . $item . "</option>\n";
}
$selectAction.="</select>";
what could the issue be?
推荐答案
selectAction =''< select id ="compAction" name ="compAction" style ="font-size:12px" onChange ="actionSelect(),document.redemptionsForm.submit();">'';
foreach(
selectAction = ''<select id="compAction" name="compAction" style="font-size: 12px" onChange="actionSelect(),document.redemptionsForm.submit();">'';
foreach(
arr as
option =>
option =>
这篇关于PHP/JavaScript未定义索引错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!