jarv Posted July 14, 2010 Share Posted July 14, 2010 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 More sharing options...
gwolgamott Posted July 14, 2010 Share Posted July 14, 2010 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 More sharing options...
jarv Posted July 14, 2010 Author Share Posted July 14, 2010 I am very new to PHP, my rsUser is: john which is being passed through from the page before. how do i do an isset check? J Link to comment https://forums.phpfreaks.com/topic/207752-undefined-index/#findComment-1086056 Share on other sites More sharing options...
wildteen88 Posted July 14, 2010 Share Posted July 14, 2010 how do i do an isset check? gwolgamott posted a code example above Link to comment https://forums.phpfreaks.com/topic/207752-undefined-index/#findComment-1086061 Share on other sites More sharing options...
gwolgamott Posted July 14, 2010 Share Posted July 14, 2010 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 More sharing options...
jarv Posted July 14, 2010 Author Share Posted July 14, 2010 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 More sharing options...
jarv Posted July 14, 2010 Author Share Posted July 14, 2010 please help Link to comment https://forums.phpfreaks.com/topic/207752-undefined-index/#findComment-1086116 Share on other sites More sharing options...
gwolgamott Posted July 15, 2010 Share Posted July 15, 2010 Need to see the code that is passing the rsUser variable to the POST. Link to comment https://forums.phpfreaks.com/topic/207752-undefined-index/#findComment-1086434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.