简体   繁体   中英

Notice: Undefined index: message error

I am trying to learn php coding and it's now hitting a snag as I keep getting an error:

Error: Notice: Undefined index: msg in C:\\xampp\\htdocs\\kubebook\\index.php on line 12

Source Code:

if ($_GET['msg'] == 1)  {

echo "You have successfully registered.";

}

You get that message when you attempt to reference an index or variable that isn't defined. In this case, you aren't passing a yourscript.php?msg=123 param to the script, so $_GET['msg'] doesn't exist. First check if it is set before looking at value

if (isset($_GET['msg']) && $_GET['msg'] == 1)  {

echo "You have successfully registered.";

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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