code:
sql.php
<?php
$uid = trim($_POST['uid']);
$pass= trim($_POST['pass']);
$type= trim($_POST['type']);
$link = mysql_connect("localhost","root","akash");
if (!$link)
die('Could not connect: '.mysql_error());
if(!mysql_select_db("fsproj",$link))
die("Can't Select database");
if ($type == 0 )
$query = "select uid from admin where uid = \"$uid\" AND password = \"$pass\"";
else
$query = "select username from user where uid = $uid AND pass = $pass";
$result = mysql_query("$query",$link);
$num_r=mysql_num_rows($result);
header("Location : codepage.php");
exit();
?>
code: login.html
<html>
<form action="sql.php" method="post" name="form1" id="form1" target=result>
Enter UID
<textarea name="uid" id="uid" rows="1" cols="40">
</textarea><br>
Password
<textarea name="pass" id="pass" rows="1" cols="40">
</textarea><br>
Type
<textarea name="type" id="type" rows="1" cols="40">
</textarea>
<br>
<input type="submit" value="Submit" />
</form>
</html>
All the files are in the same root directory, submitting the userid and password through login.html to sql.php should redirect to the file codepage.php (I havent added the login check yet, so should succeed for any values of username as password)
But when I try to do so, All I get is a blank page.
If I add an output statement after the header call, I see the output of that statement
Essentially, header("Location : codepage.php") had no effect
The header function does work in some other pages on the same site
Use curly brackets. Your code is broken the way it is.Also, it’sheader('Location: codepage.php'), notheader('Location : codepage.php'). Notice the extra space you’ve added.REMOVED