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?