[nycphp-talk] PHP and empty if form value is 0
Steve Manes
smanes at magpie.com
Sat Jan 4 22:05:38 EST 2003
At 07:28 PM 1/4/2003 -0500, Phil Powell wrote:
>foreach ($HTTP_GET_VARS as $key => $val) {
> if (!empty($HTTP_GET_VARS["$key"])) ${"$key"} = $HTTP_GET_VARS["$key"];
> }
>
> foreach ($HTTP_POST_VARS as $key => $val) {
> if (!empty($HTTP_POST_VARS["$key"])) ${"$key"} = $HTTP_POST_VARS["$key"];
> }
>
>Whenever the form variable is equal to 0, the value is not passed into the
>corresponding variable.
>
>For example, if isLogin = 1, then $isLogin = 1
>But if isRegistered = 0 then $isRegistered = {null}
empty() returns true if the variable is either not set or is zero. Try
using isset() instead.
More information about the talk
mailing list