I believe I am a bit confused with the isset function in PHP. I’m trying to use this function to determine is a field in a form is null… I was under the impressions that the isset function checks to see if a field has a value in it… but I believe the isset function only determines if the thing passed to it exists.
For example.
If I have a form input field with the name attribute set to “day”. I would use isset($_GET['day']); to determine if the form input field is not null? Or does isset just check to see if the ‘day’ exists and doesn’t check that value that it passes?
Any help would be great!
Thanks!
From the PHP
isset()page:This means that:
To sum up that bit up there,
isset()returnsFALSEif the variable is either not set (hence the function name) or containsNULLas a value. Forisset()to return true, a variable has to both exist and contain an actual value (booleanfalseincluded).In your case with
$_GET['day'], you can useisset()to check if a value has actually been passed to it (i.e., that it’s not null).