My code is:

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]>
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

Perhaps if you post some of your code we can help better?


php|architect -- The Monthly Magazine For PHP Professionals
Come visit us on the web at!

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:
> --
> PHP General Mailing List (
> To unsubscribe, visit:

MSN. Más Útil Cada Día

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to