On Wed, 2004-07-21 at 09:27, Matthew Palmer wrote:
> On Wed, Jul 21, 2004 at 03:15:51AM +1000, Howard Lowndes wrote:
> > I am trying to test the status of a value passed to a PHP program as a
> > POST parameter, specifically a SUMBIT button, thus:
> >
> > if (empty($_POST['button'])) {....
> >
> > Now, I know that the parameter is not empty because if I put a debug
> > print line before it then it will print out the value of the parameter
> > and the conditional test comes up as false, which it should, thus:
> >
> > print $_POST['button'].'<br>';
> > if (empty($_POST['button'])) {....
> >
> > but if I don't have the preceding print statement (which is only in
> > there as a debug) then the conditional test comes up as true and the
> > logic branches off in the wrong direction.
> >
> > BTW, it's PHP 4.2.2 called by Apache 2.0 on a 2.4.20 kernel.
> >
> > As I say, really weird, and even weirder is that I have another program
> > with identical logic in this same way that behaves fine.
>
> I'll bet pounds to peanuts you've typo'd the index name on the empty() call.
> Is the code above a direct cut-n-paste from your code, or a retype?
That's what I thought at first, but the editor has no problem regex'g
the index name throughout the entire code, and this pgm has been run
every week for the past 2 months, yet suddenly it breaks this week
without being touched - I can be certain of that as I am the only one
who has access to the code.
Besides which, it has two modes that it can run in depending upon a
second passed parameter. In one mode it breaks and in the other it
works, but the second parameter has nothing to do with this particular
segment of code.
It's as if there is a problem in the way in which the parameters are
being passed and accessed by the code. If I print _anything_ (not just
the index name) just before the conditional then the conditional works
fine, but that is not an acceptable kludge as it then breaks a header()
call shortly afterwards.
>
> - Matt
--
Howard.
LANNet Computing Associates;
Your Linux people <http://www.lannetlinux.com>
------------------------------------------
"When you just want a system that works, you choose Linux;
when you want a system that just works, you choose Microsoft."
------------------------------------------
"Flatter government, not fatter government;
Get rid of the Australian states."
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html