Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
href中的PHP$_GET[“action”方法不起作用_Php_Html - Fatal编程技术网

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

href中的PHP$_GET[“action”方法不起作用,php,html,Php,Html,我有一个像这样的html href <td colspan="5" align="right" bgcolor="#E6E6E6"><a href="index.php?action=createtopic"><strong>Create New Topic</strong> </a></td> 它抛出一个错误:“C:…..”中的未定义索引:action请确保设置了$\u GET['action'],以便使用: 确保设置了

我有一个像这样的html href

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

它抛出一个错误:“C:…..”中的未定义索引:action

请确保设置了
$\u GET['action']
,以便使用:


确保设置了
$\u GET['action']
,您可以使用:


代码
if($\u GET…
是否与链接/anchor/href位于同一文件中?php代码是否与链接位于同一页面上?是。。。所有内容都在index.php中,包括php代码和单击href时应显示的表单,以及与链接/anchor/href位于同一文件中的代码
if($\u GET…
)?php代码是否与链接位于同一页面上?是。。。所有内容都在index.php中,包括php代码和如果href为clickedI,则应显示的表单。我已编辑了您的答案,因为您可以在相同的if语句中完成所有操作,而不会损失任何性能,因为如果未设置,则不会检查下一个参数。我已编辑了您的答案,因为您可以在相同的if语句没有任何性能损失,因为如果未设置它,它将不会检查下一个参数
if ($_GET["action"]=="createtopic")
if( isset( $_GET["action"] ) )
{
    if( $_GET["action"] == "createtopic" )
    {
       # do something here
    }
}