Jump to content

!HELP! Undefined Index


code_god

Recommended Posts

Undefined index just means that you are asking for an array key that doesn't exist, or isn't defined.

That should also show up as a notice, and not an error.

 

<?php
{
$name = (isset($_POST['username'])) ? $_POST['username'] : NULL;
$password = (isset($_POST['password'])) ? md5 ($_POST['password']) : NULL;
echo $password;
//if(isset($_POST['notify_box'])){ $notify = $POST['notify_box'];}
}

No mate it hasn't worked I still have the notice.

 

Here they are:

 

Notice: Undefined index: username in f:\easyphp1-8\www\tim.php on line 9

Notice: Undefined index: password in f:\easyphp1-8\www\tim.php on line 10
d41d8cd98f00b204e9800998ecf8427eMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 
undefined x 1366

That doesn't look anything like the code snippet I gave you.  Here it is again.

 

{
$name = (isset($_POST['username'])) ? $_POST['username'] : NULL;
$password = (isset($_POST['password'])) ? md5 ($_POST['password']) : NULL;
echo $password;
//if(isset($_POST['notify_box'])){ $notify = $POST['notify_box'];}
}

well your issue stands in the area

echo "<br>";

if(!isset($_GET['r']))
{
	echo "<script language=\"javascript\">
	<!--
	document.location=\"$PHP_SELF?r=1&width=\"+screen.width+\"&Height=\"+screen.Height;
	//-->
	</script>";
}
else
{

	//CODE TO BE DISPLAYED IF RESOLUTION IS DETECTED
	if(isset($_GET['width']) && isset($_GET['Height']))
	{
		echo $_GET['Height']." x ". $_GET['width'];
	}
	else
	{
		echo "resolution not detected";
	}

}
?>

where are you defining "r" 

Here is your script running on my server: with the suggested fix.

	Name : 
	Password : 
	 
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.22+ (KHTML, like Gecko) Chromium/17.0.963.56 Chrome/17.0.963.56 Safari/535.22+ 
undefined x 1920

PS, the issue in this case isn't $_GET['r'] because OP is already testing if it is set.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.