# [PHP] Issue w/ GET Variables

This topic is 4878 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Whenever I try to read a get variable while it's not in the URL it gives me a warning:
Notice: Undefined index: check in \xxxxxx\xxxxxx.php on line 11
Line 11 is:
$check =$_GET['check'];
I'm guessing it's some debug feature in PHP I haven't turned off on my server? I remember I used to be able to try to read it, if it isn't there then it'd be NULL and I'd do a check against it. Now I get stupid errors. =/ I'm using IIS w/ PHP 5. Thanks!

##### Share on other sites
I haven't had much experiance with PHP5, but I do know that register_globals can mess around with some stuff. You could check the documentation (I'm assuming you already have).

##### Share on other sites
Quote:
 Original post by Rob LoachI haven't had much experiance with PHP5, but I do know that register_globals can mess around with some stuff. You could check the documentation (I'm assuming you already have).

register_globals would have made the 'check' GET variable $check automatically. The reason you're getting an index undefined error is because$_GET is an array. An associative array of key=value pairs that comes from your GET arguments. If the key "check" is not on the url, then it will not be in the array and thus the index in the array is undefined.

You will need to test it first..
$check=some default value;if(isset($_GET['check']))  $check =$_GET['check'];

##### Share on other sites
That's right..., with PHP 4 that didn't happened but now PHP 5 compains about it....

##### Share on other sites
Quote:
 Original post by haoraThat's right..., with PHP 4 that didn't happened but now PHP 5 compains about it....

It could be the php.ini settings in 5 are slightly different. Check the "Error handling and logging" section in your php.ini file.. It contains decent documentation on how to change the settings for the error_reporting and display_errors settings.

##### Share on other sites
Anyone know specifically how to shut it off or am I going hunting? I'll try that isset() check. Thanks!

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 13
• 19
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632936
• Total Posts
3009312
• ### Who's Online (See full list)

There are no registered users currently online

×