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

报告相同问题?

悬赏问题

  • ¥20 unity实习让我做一个程序
  • ¥15 idea tomcat和sql驱动不匹配吗
  • ¥15 如何查看h3c 5130s-28f-si交换机配置 及更改网口
  • ¥15 HFSS仿真喇叭天线阵列方向图出现异常
  • ¥15 blender自发光强度
  • ¥15 FIR滤波器算法设计与实现(利用库函数firdec()
  • ¥15 利用单片机产生正弦信号,来测量差分放大电路放大倍数和共模放大倍数的思路和仿真
  • ¥60 关于mavlink的论文咨询
  • ¥66 定制开发肯德基自动化网站下单软件
  • ¥15 中科院研发的TextMind(文心)