hi, i have 2 different user ~which are admin and instructor ,the admin successfully log in to admin.page and it will showing their name ,the instructor login in to instructor.page will showing their namr also.hope can help thx!!
<form id="form1" name="form1" method="post" action="">
<table width="280" height="66" border="2" cellpadding="2" cellspacing="2">
<tr>
<td width="111"> </td>
<td width="147"><label>
<input type="text" name="user" id="user" />
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="password" name="pass" id="pass" />
</label></td>
</tr>
</table>
<label>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</label>
<?php require_once('../../../Connections/admin_db.php');
mysql_select_db("admin_db");
if ((isset($_POST["Submit"])) && ($_POST["Submit"] == "Submit")) {
$username = $_POST['user'];
$password = $_POST['pass'];
//text field
$result = mysql_query("SELECT user_name FROM login WHERE user_name='$username' AND password='$password' ")
or die(mysql_error());
if(mysql_num_rows($result)) { //if exist
echo "Welcome, $username";
}
}
//else
//header('location:edit_plo_pc.php');
?>
</form>