doujiexin1136
2014-05-02 18:06 阅读 111
已采纳

未定义的常量问题

I was working on my site yesterday and all the content was appearing fine. Then today, I refreshed and something has broken.

I'm getting this error on the homepage:

Notice: Use of undefined constant Page - assumed 'Page' in includes\survey_inside.php on line 19  
Notice: Use of undefined constant Listing - assumed 'Listing' in includes\survey_inside.php on line 20

When I look on line 19 the code is:

$strPage = $_REQUEST[Page];
if($_REQUEST[mode]=="Listing"){

Like I said, everything worked fine yesterday, and I didn't change these lines. I've been looking around for several hours and am stuck. Any thoughts on how to proceed with figuring out what happened?

Thanks!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dptiq46022 dptiq46022 2014-05-02 18:10

    When you want to access an array like $_REQUEST, you have to use some key (string value). In this case you are calling $_REQUEST[Page] and $_REQUEST[mode].

    Since Page and mode are not constant values, you have to use it as a string, so:

    $strPage = $_REQUEST['Page'];
    
    if ($_REQUEST['mode'] == "Listing") { }
    
    点赞 评论 复制链接分享

相关推荐