Reputation: 597
I am just getting back in to PHP after many years and building a basic sit to start things off.
I have an index.php on my root and want to check for input from isset when either the value is ?home or just simply blank.
So easy enough I can start with:
if (isset($_GET['home']))
{
include $_SERVER['DOCUMENT_ROOT'] . '/content.html.php';
}
But my issue is trying to get it to work if there is nothing to get? I can see a couple of ways to do it but I think I am missing something simple to add to the first line.
Any help appreciated.
Lee
Upvotes: 1
Views: 6147
Reputation: 3170
isset()
checks if a variable has a value including ( False , 0 , or empty string)
, but not NULL
. Returns TRUE
if variable exists otherwise returns FALSE
.
On the other hand the empty()
function checks if the variable has an empty value, empty string , 0, NULL ,or False
. Returns FALSE
if variable has a non-empty
and non-zero
value.
For details have a look here
http://us.php.net/manual/en/function.isset.php
http://us.php.net/manual/en/function.empty.php
Upvotes: 2