dongxian8858 2014-03-15 00:20
浏览 141
已采纳

注意:未定义的索引:消息错误

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.";

}
  • 写回答

1条回答 默认 最新

  • doujiu4643 2014-03-15 00:24
    关注

    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.";
    
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有没有人知道这个问题怎么解决
  • ¥15 comsol电力电缆载流量仿真
  • ¥15 webSocket可以接TCP socket接口吗
  • ¥60 mpi并行出错,CFD++计算
  • ¥15 c#:vsto,powerpoint的外接程序中换主题颜色
  • ¥15 状态机/汽车转向灯/Sateflow
  • ¥15 这个有点复杂 有没有人看看
  • ¥15 用python如何确定子孙元素在父元素中的位置
  • ¥15 obj文件滤除异常高程
  • ¥15 用mathematicas或者matlab计算三重积分