我需要使用name="account"
访问一个HTML元素,但这是嵌入在PHP中的,我无法找到解决方法,因为我在我的网页上收到错误,“unidentified index:account”我知道这意味着它找不到那个元素。我在同一个项目中完成了同样的事情,但没有从PHP脚本中访问该元素。
导致错误的“帐户”页面中的代码行:$customerID = $_GET['account'];
其中account是我正在尝试访问的HTML元素。
下面是我的index.php页面上的“echo”代码,我试图从中访问该按钮。
echo '<div style="float:right; width:
<a href="account.php" style="display:inline-block;"><button type="submit"
name="account" class="glyphicon glyphicon-user btn btn-success" id="account">
</button></a></div>';
这很难解释,但我希望有足够的信息可以帮助别人。
您可以使用以下代码段来避免错误qazxsw poi
unidentified index: account
这里$customerID = isset($_GET['account']) ? $_GET['account'] : '';
检查索引isset
上定义的值,你得到错误,因为在account
中没有名称为account
的索引。在运行代码之前添加一个isset检查,这将防止任何错误
有关详细信息$_GET