Re: How to check for a $_GET without throwing a Notice?
| From: | John W. Holmes | Date: | Wed, 26 May 2004 15:14:49 +0000 |
| Subject: | Re: How to check for a $_GET without throwing a Notice? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186999@lists.php.net to get a copy of this message | ||
From: "Brian Dunning" <brian@briandunning.com>
> How do I check for the presence of an optional $_GET param without
> throwing a "Notice: Undefined index" when the param is not present?
>
> Tried all three of these, they all produce the Notice when the param is
> not passed:
>
> if ($_GET['id'])
> if ($_GET['id'] != "")
> if (isset $_GET['id'])
if(isset($_GET['id']))
or
if(!empty($_GET['id']))
depending upon what you want to do.
---John Holmes...