Ok on this line :

//first check to see if they have pressed the login button
if ($_POST['LoginSumbit']) //this will be the name of the button on the webpage
{

I'm getting an undefined index error. However, In my form I have this.

	//notice Mapleside is passing the session_id in when user hits login?
	echo "
	<form action='login.php?".SID."' method='post' name='Mapleside'>
	Login Name: <input type='text' name='Customer_UserName' maxlength='25' size='15'><br>
	Login Password: <input type='password' name='Customer_Password' maxlength='25' size='15'><br>
	<input type='submit' name='LoginSubmit' value='Login'>
	<input type='reset' name='Reset' value='Reset'>
	</form>";

So isn't it already defined ??? Can someone please explain to me what i'm not seeing?

    You made a typographical error. In the form you used 'LoginSubmit' but in the processing script you use 'LoginSumbit'. That said, check incoming variables with [man]isset/man or [man]empty/man before use.

      She means change

      if ($POST['LoginSumbit'])


      to

      if ($_POST['LoginSubmit'])// Submit is misspelled, therefore undefined

        Houdini, yes I already changed that but I get the same error message I'm afraid

          I just ran the code that you have shown with LoginSubmit spelled the same as in the form and it worked with or without checking for the value of 'Login' so I do't see how it could be the exact same error, perhaps a different variable?

            Notice: Undefined index: LoginSubmit in c:\program files\easyphp1-8\www\login.php on line 8

              What is on the lines 1-7 of that file?

                <?
                //start out session
                session_start();
                //Include our configuration file
                include ("config.php");

                //first check to see if they have pressed the login button
                if ($_POST['LoginSubmit']) //this will be the name of the button on the webpage
                {
                //connect to our database
                mysql_connect("localhost","root","") or die (mysql_error());

                //select our database
                mysql_select_db("mapleside") or die (mysql_error());

                  Just for being sure change the opening <? to <?php , unless in one of your queries you are calling the $_POST['LoginSubmit'] by another name or possibly have another typo then your code should not be giving that error.

                    <?php
                    //start out session
                    session_start();
                    //Include our configuration file
                    include ("config.php");
                    
                    //first check to see if they have pressed the login button
                    if ($_POST['LoginSubmit']) //this will be the name of the button on the webpage
                    {
                    	//connect to our database
                    	mysql_connect("localhost","root","") or die (mysql_error());
                    
                    //select our database
                    mysql_select_db("mapleside") or die (mysql_error());
                    
                    //get and store our variables from the form
                    $Customer_Username = $_POST['Customer_UserName'];
                    $Customer_Password = $_POST['Customer_Password'];
                    $LoginSubmit = $_POST['LoginSubmit'];
                    
                    
                    
                    //grab everything in our database that relates to the user
                    $query = mysql_query ("SELECT * FROM ".$db_table." WHERE Customer_UserName='".$Customer_UserName."'") or die (mysql_error());
                    $users = mysql_fetch_array ($query); // we use this because there is more than one file returning
                    
                    //check the username and the password according to our database
                    if ($Customer_Password != $users['password'])
                    {
                    	echo "Password is incorrect, please try again"; //display error
                    	die (); // do nothing else
                    }
                    elseif ($Customer_Password == $users['password'])
                    {
                    	$_SESSION['loggedIn'] = true;
                    	$_SESSION['Customer_UserName'] = $Customer_UserName;
                    	$_SESSION['Customer_Password'] = $Customer_Password;
                    	echo "Logged in sucessfully.<br>";
                    	echo "<a href='login.php?".SID."'>Please click here to continue</a>";
                    }
                    else
                    {
                    	echo "Username/Password invalid, please try again.";
                    }
                    }
                    else //create our form for loggin in
                    {
                    	//notice Mapleside is passing the session_id in when user hits login?
                    	echo "
                    	<form action='login.php?".SID."' method='post' name='Mapleside'>
                    	Login Name: <input type='text' name='Customer_UserName' maxlength='25' size='15'><br>
                    	Login Password: <input type='password' name='Customer_Password' maxlength='25' size='15'><br>
                    	<input type='submit' name='LoginSubmit' value='Login'>
                    	<input type='reset' name='Reset' value='Reset'>
                    	</form>";
                    
                    }
                    ?>
                    

                      Two options. You can do eaither of the following and it will have the same effect (Removing the Undefined Index notice) One is somewhat of a cheat since the notice does not stop it from working and the other is the "correct" way to do it. You were actually told how to fix it by laserlight but she didn't give an example.

                      Option (1) The cheat method where you don't have to edit your script.

                      //Add this right after <?php
                      function error_handler($errno, $errstr, $errfile, $errline, $errctx) {
                      if ($errno == E_NOTICE && substr($errstr, 0, 17) == "Undefined index:") return;
                      if ($errno & (E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR))
                      die();
                      }
                      set_error_handler("error_handler");
                      error_reporting(E_ALL);

                      That will add an error handler that will block out all Undefined index notices and run your script as it is.

                      Option (2) The way it's supposed to be done. Change you're first few lines to this.

                      <?php
                      //start out session
                      session_start();
                      //Include our configuration file
                      include ("config.php");
                      //Below checks to see if the post data is there if it is it sets it if it doesn't it doesn't.
                      $loginsubmit = isset($POST["LoginSubmit"]) ? $POST["LoginSubmit"] : '';

                      //first check to see if they have pressed the login button I edited it to check for $loginsubmit rather then a posted value.
                      if ($loginsubmit) //this will be the name of the button on the webpage
                      {
                      //connect to our database
                      mysql_connect("localhost","root","") or die (mysql_error());

                        I've taken everyone's advice however I'm still having problems with the login process. STILL no matter what username and password I put in. I STILL get "the password you entered is incorrect" Here is what I've got thus far.

                        <?php
                        //start out session
                        session_start();
                        //Include our configuration file
                        include ("config.php");
                        //Below checks to see if the post data is there if it is it sets it if it doesn't it doesn't.
                        $loginsubmit = isset($_POST["LoginSubmit"]) ? $_POST["LoginSubmit"] : '';
                        
                        //first check to see if they have pressed the login button I edited it to check for $loginsubmit rather then a posted value.
                        if ($loginsubmit) //this will be the name of the button on the webpage
                        {
                        
                        //connect to our database
                        mysql_connect("localhost","root","") or die (mysql_error());
                        
                        //select our database
                        mysql_select_db("mapleside") or die (mysql_error());
                        
                        //get and store our variables from the form
                        $Customer_UserName = $_POST['Customer_UserName'];
                        $Customer_Password = $_POST['Customer_Password'];
                        $LoginSubmit = $_POST['LoginSubmit'];
                        
                        //grab everything in our database that relates to the user
                        $query = mysql_query ("SELECT * FROM customer WHERE Customer_UserName ='".$Customer_UserName."'") or die (mysql_error());
                        $users = mysql_fetch_array ($query); // we use this because there is more than one file returning
                        
                        //check the username and the password according to our database
                        if ($Customer_UserName != $Customer_Password['Customer_Password'])
                        {
                        	echo "Password is incorrect, please try again"; //display error
                        	die (); // do nothing else
                        }
                        elseif ($Customer_Password == $Customer_UserName['Customer_Password'])
                        {
                        	$_SESSION['loggedIn'] = true;
                        	$_SESSION['Customer_UserName'] = $Customer_UserName;
                        	$_SESSION['Customer_Password'] = $Customer_Password;
                        	echo "Logged in sucessfully.<br>";
                        	echo "<a href='login.php?".SID."'>Please click here to continue</a>";
                        }
                        else
                        {
                        	echo "Username/Password invalid, please try again.";
                        }
                        }
                        else //create our form for loggin in
                        {
                        	//notice Mapleside is passing the session_id in when user hits login?
                        	echo "
                        	<form action='login.php?".SID."' method='post' name='Mapleside'>
                        	Login Name: <input type='text' name='Customer_UserName' maxlength='25' size='15'><br>
                        	Login Password: <input type='password' name='Customer_Password' maxlength='25' size='15'><br>
                        	<input type='submit' name='LoginSubmit' value='Login'>
                        	<input type='reset' name='Reset' value='Reset'>
                        	</form>";
                        
                        }
                        ?>
                        
                          	if ($Customer_UserName != $Customer_Password['Customer_Password'])

                          This doesn't make sense. Is $Customer_Password an array? Is $Customer_UserName supposed to be the same as $Customer_Password['Customer_Password']? Maybe you mean something like

                          if($Customer_Password != $users['Customer_Password'])
                            Write a Reply...