简体   繁体   English

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

[英]Notice: Undefined index: in C:\wamp\www\tests\Joomla\Website\index.php on line 37

Hey i get this : Notice: Undefined index: in C:\\wamp\\www\\tests\\Joomla\\Website\\index.php on line 37 嘿,我得到了:注意:未定义索引:在C:\\ wamp \\ www \\ tests \\ Joomla \\ Website \\ index.php中的第37行

And my code is this : 我的代码是这样的:

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

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

I don't understand why i get this . 我不明白为什么要得到这个。 Please help! 请帮忙!

First, you don't say where is the line 37... I ain't a wizard, but I can guess from the error... 首先,您不说第37行在哪里...我不是向导,但我可以从错误中猜测...

Since the error is Undefined index , that must come from the line: 由于错误是Undefined index ,所以必须来自以下行:

$remarks=$_GET['remarks'];

You should validate that $_GET['remarks'] is not null with isset($_GET['remarks']) before trying to get it's value. 在尝试获取$_GET['remarks']的值之前,应使用isset($_GET['remarks'])验证其是否为null。


Second, that line does not make any sence, since the $remarks can never be null and "" : 其次,该行没有任何意义,因为$remarks绝不能为null""

 if ($remarks==null and $remarks=="")


So I would write the code like this: 所以我会这样写代码:

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

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

暂无
暂无

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

相关问题 注意:未定义的索引:第63行的C:\\ wamp \\ www \\ chatsystem \\ index.php中的名称 - Notice: Undefined index: name in C:\wamp\www\chatsystem\index.php on line 63 注意:未定义的变量:第7行的C:\\ wamp \\ www \\ cbmall \\ index.php中的db_host - Notice: Undefined variable: db_host in C:\wamp\www\cbmall\index.php on line 7 我有错误:注意:未定义偏移量:C:\\ wamp \\ www \\ index.php在32行,34行,36行,38行的C:\\ wamp \\ www \\ index.php中 - I have error:Notice: Undefined offset: 1 in C:\wamp\www\index.php on line 32,on line 34,on line 36,on line 38 注意:未定义的索引:第46行的C:\\ wamp \\ www \\ upload.php中的fileToUpload - Notice: Undefined index: fileToUpload in C:\wamp\www\upload.php on line 46 注意:未定义的索引:第164行的C:\\ wamp \\ www \\ blog \\ news.php中的pre - Notice: Undefined index: pre in C:\wamp\www\blog\news.php on line 164 注意:未定义偏移量:1 in C:\\xampp\\htdocs\\index.php 第 5 行 - Notice: Undefined offset: 1 in C:\xampp\htdocs\index.php on line 5 PHP错误提示:未定义的索引:第35行的C:\\ wamp \\ www \\ tweetball \\ classes \\ word.class.php中的UserID - Php error Notice: Undefined index: UserID in C:\wamp\www\tweetball\classes\word.class.php on line 35 复选框值未获取-&gt;注意:未定义的索引:第27行的C:\\ wamp \\ www \\ crud_exer1 \\ content.php中的name1 - checkbox value not get -> Notice: Undefined index: name1 in C:\wamp\www\crud_exer1\content.php on line 27 未定义索引:第 4 行 C:\wamp\www\emailvalidate.php 中的电子邮件 - Undefined index: email in C:\wamp\www\emailvalidate.php on line 4 未定义索引:在第 4 行输入 C:\\wamp\\www\\submit.php - Undefined index: type in C:\wamp\www\submit.php on line 4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM