繁体   English   中英

href中的PHP $ _GET [“ action”]方法不起作用

[英]PHP $_GET[“action”] method in href not working

我有这样的html href

<td colspan="5" align="right" bgcolor="#E6E6E6"><a href="index.php?action=createtopic"><strong>Create New Topic</strong> </a></td>

但是当我使用它

if ($_GET["action"]=="createtopic")

它将引发错误:未定义的索引:“ C:....”中的操作

确保设置了$_GET['action'] ,为此您可以使用isset()

if( isset( $_GET["action"] ) )
{
    if( $_GET["action"] == "createtopic" )
    {
       # do something here
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM