Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.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
注意:未定义的索引:在C:\wamp\www\tests\Joomla\Website\index.php的第37行_Php_Notice - Fatal编程技术网

注意:未定义的索引:在C:\wamp\www\tests\Joomla\Website\index.php的第37行

注意:未定义的索引:在C:\wamp\www\tests\Joomla\Website\index.php的第37行,php,notice,Php,Notice,注意:未定义的索引:在C:\wamp\www\tests\Joomla\Website\index.php的第37行 我的代码是: <?php $remarks=$_GET['remarks']; if ($remarks==null and $remarks=="") { echo ''; } if ($remarks=='success') { echo 'Registration Success';

注意:未定义的索引:在C:\wamp\www\tests\Joomla\Website\index.php的第37行

我的代码是:

<?php 
    $remarks=$_GET['remarks'];

    if ($remarks==null and $remarks=="")
    {
        echo '';
    }
    if ($remarks=='success')
    {
        echo 'Registration Success';
    }
?>


我不明白为什么我会得到这个。请帮忙

首先,你不要说37号线在哪里。。。我不是巫师,但我能从错误中猜出来

由于错误是
未定义索引
,因此必须来自以下行:

$remarks=$_GET['remarks'];
在尝试获取其值之前,应使用
isset($\u GET['marks'])
验证
$\u GET['marks']
是否不为空


第二,这一行没有任何意义,因为
$markes
永远不能
null


所以我会这样写代码:

<?php 
    $remarks = "";
    if ( isset($_GET['remarks']) ) {
        $remarks = $_GET['remarks'];
    }

    if ( $remarks == 'success' ) {
        echo 'Registration Success';
    }
?>  

这将有助于您确定代码中的哪一行是
第37行
。帖子中也不需要您的HTML,因为这是一个PHP错误。此外,if($comments==null和$comments==“”)行可能应该有一个或而不是and(因为$comments不能同时为null和“”):if($comments==null或$comments==“”)
<?php 
    $remarks = "";
    if ( isset($_GET['remarks']) ) {
        $remarks = $_GET['remarks'];
    }

    if ( $remarks == 'success' ) {
        echo 'Registration Success';
    }
?>