Re: How to check for a $_GET without throwing a Notice?
| From: | Richard Davey | Date: | Wed, 26 May 2004 15:07:01 +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-186997@lists.php.net to get a copy of this message | ||
Hello Brian,
Wednesday, May 26, 2004, 4:01:30 PM, you wrote:
BD> How do I check for the presence of an optional $_GET param without
BD> throwing a "Notice: Undefined index" when the param is not present?
BD> Tried all three of these, they all produce the Notice when the param is
BD> not passed:
BD> if ($_GET['id'])
BD> if ($_GET['id'] != "")
BD> if (isset $_GET['id'])
if (isset($_GET['id']))
{
$id = $_GET['id'];
}
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde