i would like to create php login form but the problem is the form doesnt do anything
why isnt working
thanks
Code:
<?php require_once("nocache.php"); ?> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>login.php</title> <?php if(isset($_POST['Submit'])) if (empty($id) || empty($pword)){ header("location: login.php"); }else{ $conn = mysql_connect("localhost", "TWAassign2", "student"); if(!$conn){ die('Conection could not be opened: ' . mysql_error()); } $db_selected = mysql_select_db('acadcredit', $conn); $sql = "SELECT staffID, accessLevel FROM staff WHERE id = '$id' AND password = '$pword'"; $rs = mysql_query($sql, $conn); if (mysql_num_rows($rs)> 0 ) { session_start(); $_SESSION["who"] = $id; $_SESSION["level"] = mysql_result($rs,0,"level"); header("location: selectView.php"); }else{ header("location: login.php"); } } ?> </head> <body> <form method="post" action="login.php"> <h1> Welcome to Login Page </h1> <h2> Please enter Your Staff ID and password- Thanks</h2> <p>Staff ID <input type="text" name="ID" /><br/> Password <input type="password" name="pass" /></p> <p> <?php if(isset($_POST['ID'])){ $id = $_POST["ID"]; $pword = $_POST["pass"]; } ?> <input type="submit" value="login" /> <input type="reset" value="Reset" /></p> </form> </body> </html>
thanks
Comment