Hey,
I'm trying to get a page that goes through different situations via the GET variable. Because of this, I need to be able to deal with not having anything in the GET array (if the user just goes to x.php). The way I have it now is something like such:
if (!array_key_exists('page', $_GET) && !empty($_GET))
{
//Put in template code for error page
print 'Wrong GET name!';
}
else
{
//Page 1 - Welcome, process explanation
if($_GET['page'] == "1" || empty($_GET))
{
//Page one output!
print "Page 1 / Empty";
}
}
Now, I know there's something wrong here, in the fact that if I run the script without passing a GET variable, I get a warning/error, because $_GET['page'] isn't set. How can I get around this? Is there no way to supply results for both scenarios?
Thanks
FlyingIsFun1217