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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cathari
Forum Newbie
Posts: 11
Joined: Mon May 13, 2002 9:51 pm

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

Post 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......
User avatar
cwcollins
Forum Commoner
Posts: 79
Joined: Thu May 16, 2002 3:51 pm
Location: Milwaukee, WI, USA

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

Post 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
leenoble_uk
Forum Contributor
Posts: 108
Joined: Fri May 03, 2002 10:33 am
Location: Cheshire
Contact:

noticed this..

Post by leenoble_uk »

switch($_POST['action']){
   case "submit":
      verify();
   break;
   
   case "add"; //Shouldn't this be a :
      add();
      
   default:
      index();
   break;

}
User avatar
cwcollins
Forum Commoner
Posts: 79
Joined: Thu May 16, 2002 3:51 pm
Location: Milwaukee, WI, USA

Post by cwcollins »

yes it should! good eyes.
Post Reply