What does $_GET return when the index is not set? (Couldn’t find anything in php manual about $_GET.)
I wrote this to check, if the $_GET[‘id’] isset – and if it is not, set $id to false:
<?php $id = (isset($_GET['id'])) ? $_GET['id'] : false ?>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$_GET is just an ordinary array, so it behaves exactly the same as any other array.
This means, it will return NULL to the variable and raise the “undefined index” notice when you call a non-existing index.
The only thing you need to be aware of with $_GET is that is contains unsafe (user-modifiable) data