PHP/JavaScript未定义索引错误 [英] Php/javascript undefined index error

查看:87
本文介绍了PHP/JavaScript未定义索引错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆