Very basic PHP problem

Soldato
Joined
14 Apr 2004
Posts
11,888
Location
UK
I've currently got a page set up which accepts a users credentials (username + password) it connects to a mysql database and checks if it matches the detals within database.

That works fine and I've set up a header in place to take them to the appropriate page.

Now I'm trying to pass a session forward and it isn't working for some bizarre reason.

PHP:
// 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){
session_register("email");
header("location: loginsuccess.php");
}

It forwards the page fine and echo's the variable back for testing. However on the next page it doesn't read the value to me.

I have the following set up:

PHP:
<?php
session_start();
$email = $_SESSION['email'];
echo $email;
?>
Nothings coming up. I've done this before and this method worked fine. I'm sure its something silly. Would appreciate any help.

Cheers :)
 
Back
Top Bottom