Apersinsrap
New Member
I currently have a login system on my index page; which is working fine. However, when a user logs in, it directs them to a completely new page which i don't want. How to I implement the code so that; A) the user stays on the index page after loginB) A welcome message "Welcome...." displays on the index page. index.html\[code\]<div id="leftmenu_top"></div> <div id="leftmenu_main"> <div class="login"> <h3>Please login below</h3> <br/> <!--Log in form--> <html><form action='login.php' method='POST'>Username: <input type='text' name='username'><br>Password: <input type='password' name='password'><br><input type='submit' value='http://stackoverflow.com/questions/15735839/Log in'></form></html>\[/code\]login.php\[code\]<?phpsession_start();$username = strtolower($_POST['username']);$password = strtolower($_POST['password']);if ($username&&$password){$connect = mysql_connect("localhost", "root", "") or die("Couldn't connect");mysql_select_db("a&e") or die("Couldn't find db");$query = mysql_query("SELECT * FROM users WHERE username='$username'");$numrows = mysql_num_rows($query);if ($numrows==!0){//code to loginwhile ($row = mysql_fetch_assoc($query)){ $dbusername = $row['username']; $dbpassword = $row['password'];}//check to see if they matchif($username==$dbusername&&$password==$password){echo "Welcome $username";$_SESSION['username']=$username;}elseecho "incorrect password";}else die("That user does not exist");}else die("please provide a username and password");?>\[/code\]