Page 1 of 1

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

Posted: Thu Feb 08, 2007 12:19 am
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.

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

Posted: Thu Feb 08, 2007 12:36 am
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.