dse3168 2013-09-05 14:07
浏览 40

为什么$ _GET不能运行PHP 5.3.21?

I'm using $_GET within a switch statement to determine with options to display in a select box. Things were great until I upgraded my server to PHP 5.3.21. Now I get undefined index and undefined variable error messages. I've modified my code to include if isset(). Now there are no errors, but I can't get PHP to recognize that $_GET["menuid"} does have a value.

URL that I'm trying to get variables from:

http://www.example.com/mod/page/view.php?id=5100&module=1&menuid=2&module=1&page=2

Code I'm using:

if (isset($_GET['menuid'])) {
    $menuid = $_GET['menuid'];
}
else {
    $menuid = "not working";
}

echo $menuid;
switch($menuid) {
    // My code
   }

The results are:

"not working"

EDIT: Results of `var_dump($_GET)' on the PHP sub page

array(0) { }

EDIT: Results of var_dump($_GET) on the PHP main page

array(4) { ["id"]=> string(4) "5100" ["module"]=> string(1) "1" ["menuid"]=> string(1) "2" ["page"]=> string(1) "2" }

The above var_dump is from the PHP main page. The original code is on a separate PHP page that I've included to the PHP main page with a file_get_contents();. Would the file_get_contents() cause this problem?

  • 写回答

2条回答 默认 最新

  • doumu8911 2013-09-05 14:11
    关注

    You have two times a "module" defined. I think the right URL looks like this:

    http://www.example.com/mod/page/view.php?id=5100&menuid=2&module=1&page=2

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测