Re: isset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Kurth wrote:
> What do you do when isset does not work? If I send data in a
> $_REQUEST['var'] like 
> if (isset($_REQUEST['var'])) {
> }
> Put var has no data it still says it is set. Because $_REQUEST['var'] = ""
> and isset thinks "" is set

php -r ' $r = array("foo" => ""); var_dump(isset($r["foo"]),empty($r["foo"]));'

so empty() should give you the result your looking for  ...
some tips:

1. generally use $_GET or $_POST in preference to $_REQUEST
2. be specific about your input validation, e.g.:

if (isset($_GET['var']) && ($_GET['var'] == 'foo')) {
	echo "got it!";
}

> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux