Re: $_POST bug?
| From: | Ryan Thompson | Date: | Thu, 13 Nov 2003 06:55:43 +0000 |
| Subject: | Re: $_POST bug? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169437@lists.php.net to get a copy of this message | ||
On Thursday 13 November 2003 00:59, Jake McHenry wrote:
> > -----Original Message-----
> > From: Jake McHenry [mailto:linux@nittanytravel.com]
> > Sent: Thursday, November 13, 2003 12:53 AM
> > To: php-general@lists.php.net
> > Subject: [PHP] $_POST bug?
> >
> >
> > I have 5 fields, all 1 character in length, numbers being
> > entered. If zero's are entered in the boxes, and the form is
> > submitted, the corresponding $_POST variables are empty? Is
> > there a way around this, or am I doing something wrong?
> >
> > I guess I could just do, if (isset(... Blah.. Then if it's
> > not set then manually set the variable name to 0...
> >
> > Has anyone else run across this?
> >
> > Thanks,
> >
> > Jake McHenry
> > Nittany Travel MIS Coordinator
> > http://www.nittanytravel.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> Just to test, I changed the input field length to 3, and every time I
> tried it, single 0 does not create the $_POST variable. Double 0's
> create it, along with any other numbers, it's only when a single 0 is
> entered. Is this a bug or happening for a reason?
>
>
>
> Thanks,
>
> Jake McHenry
> Nittany Travel MIS Coordinator
> http://www.nittanytravel.com
PHP uses the 0 as the flag for FALSE. And anything other then 0 is TRUE.
If I understand the workings of PHP FALSE can also be interpreted as NULL.
So PHP sees the post as saying the fields are NULL.
I could be wrong on this but I think that's where the problem is. Whether the
developers planned this or it's slipped through that cracks I have no idea.
Did you checkout http://bugs.php.net to see if there's
anything listed about
it?
--
"I have a photographic memory. I just forgot the film" --Unknown
=============================
Ryan Thompson
rthomp@sympatico.ca
http://osgw.sourceforge.net