Re: Undefined index:
| From: | Erwin | Date: | Wed, 02 Oct 2002 08:03:41 +0000 |
| Subject: | Re: Undefined index: | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118552@lists.php.net to get a copy of this message | ||
Voisine wrote:
> Hi,
>
> I'm learning php from a book but because of global off I have have
> several "Undefined index" message! I don't want to change the default
> setting in my php.ini because I want to learn the good way.
> What I'm doing wrong?
>
> Undefined index: categorie
> if ($_POST['categorie'] == "New") {
You're not doing anything wrong. The problem here is that error_reporting
has notices on. The $_POST['categorie'] is not defined.
Change the error_reporting to excluse ERR_NOTICE, or use:
if ( isset( $_POST['categorie'] ) && $_POST['categorie'] ==
'New' ) }
// Your code here
}
HTH
Erwin