page navigation
Posted: Fri Dec 31, 2010 4:05 am
<html>
<body>
<div style="position:absolute;top:150px;left:780px">
<table border=0>
<form method=post action="<?php echo $_SERVER['PHP_SELF']; ?>">
<tr>
<td>User Name:<input type=text name=uname>
</tr>
<tr>
<td>Password: <input type=password name=pwd>
</tr>
<tr>
<td>
<center><input type=submit name=sub value=submit></center>
</td>
</tr>
</form>
</div>
<?php
if(isset($_POST['sub']))
$uname=$_POST['uname'];
$pwd=$_POST['pwd'];
$con=mysql_connect("localhost","root","");
mysql_select_db("my_db",$con);
$result=mysql_query("select * from logi where uname='$uname' and pwd='$pwd'");
$num=mysql_num_rows($result);
if($num<1)
{
echo "login failed";
}
else
{
echo "loggin success";
header('Location: newmob.php');
//exit();
}
}
?>
here login is success but when i try to move next page it showed error cant change header,,,,,,,,,,,,,help pls
<body>
<div style="position:absolute;top:150px;left:780px">
<table border=0>
<form method=post action="<?php echo $_SERVER['PHP_SELF']; ?>">
<tr>
<td>User Name:<input type=text name=uname>
</tr>
<tr>
<td>Password: <input type=password name=pwd>
</tr>
<tr>
<td>
<center><input type=submit name=sub value=submit></center>
</td>
</tr>
</form>
</div>
<?php
if(isset($_POST['sub']))
$uname=$_POST['uname'];
$pwd=$_POST['pwd'];
$con=mysql_connect("localhost","root","");
mysql_select_db("my_db",$con);
$result=mysql_query("select * from logi where uname='$uname' and pwd='$pwd'");
$num=mysql_num_rows($result);
if($num<1)
{
echo "login failed";
}
else
{
echo "loggin success";
header('Location: newmob.php');
//exit();
}
}
?>
here login is success but when i try to move next page it showed error cant change header,,,,,,,,,,,,,help pls