NYCPHP Meetup

NYPHP.org

PHP and empty() if form value is 0

Phil Powell soazine at erols.com
Sat Jan 4 19:26:02 EST 2003


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}

I do not understand why this happens, someone enlighten me!

Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030104/c9da3009/attachment.html>


More information about the talk mailing list