Posted by Michael Fesser on 06/26/07 14:34
..oO(yaaros@gmail.com)
>Hello !! I have a problem with error_logs. The problem is in this
>code:
>
>$id_tmp = $_REQUEST["id"];
>if(!isset($id_tmp) && empty($id_tmp)){
> invalidArgs();
> echo "buug";
>}
>
>I'd like to check if the variable id is passed by GET method to the
>script.
If you're expecting a GET variable then use the $_GET array. The
$_REQUEST array contains values from three(!) different sources and
should only be used in very special cases.
Additionally you should set error_reporting to E_ALL in your php.ini.
The first line from the code above will cause a notice if no 'id'
parameter was submitted.
It should be something like:
if (!isset($_GET['id'])) {
invalidArgs();
echo "buug";
}
If you also want to check for empty parameters add an OR condition:
if (!isset($_GET['id']) || empty($_GET['id'])) {
invalidArgs();
echo "buug";
}
Micha
Navigation:
[Reply to this message]
|