Help with "Undefined index: action in /var/www/html/ind

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
sarbas
Forum Commoner
Posts: 64
Joined: Thu Jan 04, 2007 5:51 am

Help with "Undefined index: action in /var/www/html/ind

Post by sarbas »

Hello everybody,

I'm new dude using PHP5 in linux.
Here my problem is while I'm using ($_REQUEST["action"] method I got the following error/warning message...

Notice: Undefined index: action in /var/www/html/intra/initial.php on line 5

My code on line 5 is:

Code: Select all

if ($_REQUEST["action"] == "delete" and trim($_REQUEST['id']) <> "") {
			$result = @mysql_query("DELETE FROM ".$tablename." WHERE id = '".trim($_REQUEST['id'])."'");
		}
[/b]
I'm using PHP5 in linux environment. And is it the problem with
register_globals = Off
register_long_arrays = Off
. But I changed this to vars to On in my php.ini. Is there any other variables to change.

And the next thing whether the above message is a error message or warning message, If it is warnings how to disable this warings using my php.ini file. Let me know the particular variable to disable for not getting only warnings.


Thanks in advance.
Veeraa.
Is there any mistake pls forgive me.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Help with "Undefined index: action in /var/www/html

Post by Christopher »

Code: Select all

if (isset($_REQUEST["action"] ) && ($_REQUEST["action"] == "delete") && trim($_REQUEST['id']) <> "") {
			$result = @mysql_query("DELETE FROM ".$tablename." WHERE id = '".trim($_REQUEST['id'])."'");
		}
Hopefully you can see that you should probably validate and filter your request vars before you get to this section of code.
(#10850)
Post Reply