Page 1 of 1

Is it me or just the notices that's silly : Version 4.2.0

Posted: Tue May 14, 2002 3:24 pm
by cathari
The code is working fine but i'm getting a notice from PHP about undefined index. Do I just have to ignore it or there is something really wrong here.

I'm using PHP Ver. 4.2.0

Here's the code:

Code: Select all

switch($_POSTї'action']){
	case "submit":
		verify();
	break;
	
	case "add";
		add();
		
	default:
		index();
	break;

}
Here's the notice :

Undefined index : action......

Re: Is it me or just the notices that's silly : Version 4.2.

Posted: Fri May 17, 2002 9:16 am
by cwcollins
i ran into something like this when i had the error repoting in php.ini set to report way more info than i needed. actualy, it was set this way by default.

because it is a notice, and not a warning, i imagine you can ignore it. if this is on a machine you control, maybe look at the error_reporting line in php.ini. in 4.2.0 the defauly is

Code: Select all

error_reporting = E_ALL
If you change it to:

Code: Select all

error_reporting = E_ALL & ~E_NOTICE
it will stop reporting notices. i still turn this back on when developing. it often provide some usefull information. help write tighter, better code.

good luck.

c.w.collins

noticed this..

Posted: Fri May 17, 2002 9:21 am
by leenoble_uk
switch($_POST['action']){
   case "submit":
      verify();
   break;
   
   case "add"; //Shouldn't this be a :
      add();
      
   default:
      index();
   break;

}

Posted: Fri May 17, 2002 9:43 am
by cwcollins
yes it should! good eyes.