Forum Moderators: coopster

Message Too Old, No Replies

Undefined index: QUERY_STRING

How can I get rid of that?

         

Sinner_G

3:39 pm on Sep 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm sure this is obvious and I'm missing something basic, but...

I have this function which should check whether the URL contains a query string and if so print it:

<?php
if (!is_null($_SERVER['QUERY_STRING'])) {
print ($_SERVER['QUERY_STRING']);
}
?>

Now if there IS a query string, it qorks perfectly. If there is none, though, I get a notice telling me

Undefined index: QUERY_STRING in path\to\my_page.php on line xx.

How can I get rid of that?

justageek

4:45 pm on Sep 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use isset() instead.

Sinner_G

4:48 pm on Sep 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Works perfectly, thanks justageek.