Jump to content

Recommended Posts

I'm having trouble accessing the query string with $_GET.

Using a command line of:  http://localhost:38094/word_passed_in_the_url_is.php?resource=apples

 

My test program gives:

 

_SERVER["QUERY_STRING"]: resource=apples

_SERVER["REQUEST_URI"]: /word_passed_in_the_url_is.php?resource=apples

var_dump($_REQUEST): array(0) { }

var_dump($_GET): array(0) { }

 

Trying to access $_GET throws an error because it is undefined. It's odd because _SERVER["QUERY_STRING"] is populated.

 

My system is Expressions WEB 3.0 using it's development server, Windows 7, and PHP 5.3.0

 

phpinfo(); runs fine. The folks at the WEB Expression message board have not seen this before.

 

<?php 
echo '<br>_SERVER["QUERY_STRING"]:    ' . $_SERVER["QUERY_STRING"];
echo '<br>_SERVER["REQUEST_URI"]:    ' . $_SERVER["REQUEST_URI"];
echo '<br>var_dump($_REQUEST):   ';
var_dump($_REQUEST);
echo '<br>var_dump($_GET):   ';
var_dump($_GET);
echo '<br><br>';
echo '<pre>';
phpinfo();
echo '</pre>';
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/175049-_get-not-working/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.