page not redirecting

Hello:

I have created a page that checks a database to see if a user is registered or not. If the user is registered he is supposed to be forwarded to a page called success.html. The code I am using looks like this:

$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){

// Register $myusername, $mypassword and redirect to file “success.html”

session_register(“myusername”);
session_register(“mypassword”);
echo “Success Launch”;
header (“Location: success.html”);
}
else {
echo “Wrong Username or Password”;

}

The if logic is working correctly as evidenced by seeing the echos. However, the script is not forwarding to success.html which is, of course, in the same directory. The page simply sits there showing me the success text that I am echoing. What am I missing?

Kevin

echo out $count to see if the query is working. sounds to me like its not working.

The If Statement Logic:
if($count==1){

// Register $myusername, $mypassword and redirect to file “success.html”

session_register(“myusername”);
session_register(“mypassword”);
echo “Success Launch”;
header (“Location: success.html”);
}
else {
echo “Wrong Username or Password”;

}
is printing out the correct echo for success or failure so the if statement has to be working, correct?

OK:

I echoed count and it correctly returned a 1

The code looks like

$sql=“SELECT * FROM $tbl_name WHERE Email=’$myusername’ and Pass=’$mypassword’”;
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){

// Register $myusername, $mypassword and redirect to file “login_success.php”

session_register(“myusername”);
session_register(“mypassword”);
echo “found”;
echo $count;
header(“Location:ht1/index.html”);

}
else {
echo “Wrong Username or Password”;

}

However, the redirect is not responding

Sponsor our Newsletter | Privacy Policy | Terms of Service