Re: Need to check whether a param exists!
| From: | Chris Shiflett | Date: | Mon, 03 Feb 2003 17:04:05 +0000 |
| Subject: | Re: Need to check whether a param exists! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134144@lists.php.net to get a copy of this message | ||
--- Brian Dunning <brian@briandunning.com> wrote:
> All I'm trying to do is check for the presence of a
> query string, but everything I try gives me an
> Undefined Index error.
...
> http://www.mysite.com/index.php?page=hello
>
> <?php
> if (is_object($_REQUEST['page']))
> $pagename = $_REQUEST['page'];
> else
> $pagename = "home";
> ?>
You want isset($_GET['page']). However, this is not the
query string; it is a single variable within the query
string. If you want to access the raw query string, use
$_SERVER['QUERY_STRING'].
Chris