EchoFool Posted September 4, 2010 Share Posted September 4, 2010 Error Level: 8 Error Message: Undefined index: register Error File: index.php Error Line: 114 Error Context: Array The line 114 is: if($_GET){}else{ echo hi; } I thought this was perfectly fine syntax to check if a GET of any kind is set yet i get this error in my logs which is very odd. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/212555-what-does-this-error-mean/ Share on other sites More sharing options...
wildteen88 Posted September 4, 2010 Share Posted September 4, 2010 You sure this is line 114 from index.php? if($_GET){}else{ echo hi; } I see no point in having that line of code as the $_GET superglobal variable will always be defined as an empty array, whether there isn't any query string variables being passed to the script. Quote Link to comment https://forums.phpfreaks.com/topic/212555-what-does-this-error-mean/#findComment-1107338 Share on other sites More sharing options...
EchoFool Posted September 4, 2010 Author Share Posted September 4, 2010 Well the idea is to hide a DIV when any type of GET is set and it does work according to the page - the div hides when any GET is set but then this error occured at the same time even though it worked. Would the isset work ? Or would that require a specific GET['name'] because of again the array issue? And yes that is currently the test script - stuff before the line 114 is html output stuff Quote Link to comment https://forums.phpfreaks.com/topic/212555-what-does-this-error-mean/#findComment-1107340 Share on other sites More sharing options...
wildteen88 Posted September 4, 2010 Share Posted September 4, 2010 A better approach would be to check whether the variable $_SERVER['QUERY_STRING'] is empty // nothing in the query string. Show the div if(empty($_SERVER['QUERY_STRING'])) { echo '<div>whatever</div>'; } Quote Link to comment https://forums.phpfreaks.com/topic/212555-what-does-this-error-mean/#findComment-1107342 Share on other sites More sharing options...
EchoFool Posted September 4, 2010 Author Share Posted September 4, 2010 Argh thanks that worked Solved ! Quote Link to comment https://forums.phpfreaks.com/topic/212555-what-does-this-error-mean/#findComment-1107344 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.