Try

if (isset ($status) && $status == 'ADD')

instead... this should take care of the error--IF you're sure that the
fact that the $status variable is not set at that point is ok.


Marco

-------------
php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at http://www.phparch.com!

On Fri, 2002-11-08 at 11:04, R B wrote:
> My code is:
> 
> <?php
>   some code.....
>   ....
>   ....
> 
>   if ($status == "ADD") {
> 
>     some code ...
>     ...
>     ...
>   }
> ?>
> The message is: "Notice: Undefined variable: status in ...."
> 
> I'm going to explain how my script work.
> I have an php page (addProduct.php) with an input form. I have 2 buttons 
> (add and cancel) and a hidden control with name=status. If i press the add 
> button, the page submit the form data to the same page (<form 
> action="addProduct.php">) with status hidden control name set to ADD, so the 
> if statement its true only if i press the add button.
> I see the message when i call the page to add the data not when i submit the 
> data.
> 
> How can i fix the problem? or there is another best way to do this?
> 
> 
> 
> >From: Marco Tabini <[EMAIL PROTECTED]>
> >To: R B <[EMAIL PROTECTED]>
> >CC: [EMAIL PROTECTED]
> >Subject: Re: [PHP] Other Notice problem...
> >Date: 08 Nov 2002 10:25:46 -0500
> >
> >This usually means that you're using a variable without having
> >initialized it. For example
> >
> >$a = $b + 1;
> >
> >will give you that warning if no value is assigned to $b prior to this
> >line. It's PHP's way of telling you that you might be doing something
> >wrong.
> >
> >Perhaps if you post some of your code we can help better?
> >
> >
> >Marco
> >
> >-------------
> >php|architect -- The Monthly Magazine For PHP Professionals
> >Come visit us on the web at http://www.phparch.com!
> >
> >On Fri, 2002-11-08 at 10:31, R B wrote:
> > > This is not the same question i asked yesterday.
> > >
> > > When i set error_reporting  =  E_ALL and display_errors = On in my 
> >php.ini,
> > > i get the next message:
> > >
> > > "Notice: Undefined variable: varname in ....".
> > >
> > > How can i fix this problem without setting error_reporting  =  E_ALL &
> > > ~E_NOTICE and/or display_errors = Off, or what way do you think is the 
> >best
> > > to resolve this problem?
> > >
> > > Thanks,
> > >
> > > RB
> > >
> > >
> > >
> > > _________________________________________________________________
> > > Charla con tus amigos en línea mediante MSN Messenger:
> > > http://messenger.microsoft.com/es
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> 
> 
> _________________________________________________________________
> MSN. Más Útil Cada Día http://www.msn.es/intmap/
> 



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

Reply via email to