Jump to content

Undefined index?


jarv

Recommended Posts

hi, can someone please help?

 

I get the following error:

 

 

Notice: Undefined index: rsUser in D:\mutecms.com\wwwroot\adminphp\default.php on line 43

 

here are the lines that are erroring:

// login must be between 4 and 15 chars containing alphanumeric chars only:
field_validator("rsUser", $_POST["rsUser"], "alphanumeric", 4, 15);
// password must be between 4 and 15 chars - any characters can be used:
field_validator("rsPass", $_POST["rsPass"], "string", 4, 15);

 

thanks in advance!

 

J

Link to comment
https://forums.phpfreaks.com/topic/207752-undefined-index/
Share on other sites

The POST value for rsUser is not named wrong with a typo from the page you are receiving that POST from is it?

 

EDIT: Also be sure it has a value... do and isset check on the rsUser & rsPass POST variables then do that code... or something

 

if(isset($_POST["rsUser"])){
// login must be between 4 and 15 chars containing alphanumeric chars only:
   field_validator("rsUser", $_POST["rsUser"], "alphanumeric", 4, 15);
   // password must be between 4 and 15 chars - any characters can be used:
   field_validator("rsPass", $_POST["rsPass"], "string", 4, 15);
}

Link to comment
https://forums.phpfreaks.com/topic/207752-undefined-index/#findComment-1086040
Share on other sites

Let me see the code where john is assigned in the page before too...

 

But this is an error usually associated to passing a variable that has no value to a function or whatnot...

 

To Do an isset check do something like this:

if(isset($_POST["rsUser"]))
{
  //Any code here will run if rsUser has any value or otherwise it is set
}

if(!isset($_POST["rsUser"]))
{
//Any code her will run if rsUser has no value or otherwise  not set
}

Link to comment
https://forums.phpfreaks.com/topic/207752-undefined-index/#findComment-1086064
Share on other sites

ok, I think I managed to log in but I flushed the session and now I get:

 

no User

Notice: Undefined index: rsUser in D:\mutecms.com\wwwroot\adminphp\default.php on line 86

There were problems with the previous action. Following is a list of the error messages generated:

 

    * Incorrect login/password, try again

 

 

here is my new code

// login must be between 4 and 15 chars containing alphanumeric chars only:
if(isset($_POST["rsUser"]))
{
//Any code here will run if rsUser has any value or otherwise it is set
field_validator("rsUser", $_POST["rsUser"], "alphanumeric", 4, 15);
}

if(!isset($_POST["rsUser"]))
{
//Any code here will run if rsUser has no value or otherwise  not set
echo 'no User';
}

if(isset($_POST["rsPass"]))
{
// password must be between 4 and 15 chars - any characters can be used:
field_validator("rsPass", $_POST["rsPass"], "string", 4, 15);
}

if(!isset($_POST["rsPass"]))
{
// password must be between 4 and 15 chars - any characters can be used:
echo 'no password';
}

Link to comment
https://forums.phpfreaks.com/topic/207752-undefined-index/#findComment-1086087
Share on other sites

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.