Hi,

I'm trying to allow my members to login to their accounts, and change their personal info (name, email address, password, etc...)

It all seems okay, except that the table that suppose to show members' information is empty. Of course, I'm using the Value="" attribute. But it's not working.

This is the login form
HTML Code:
<form name="login" method="post" action="validate.php">
<table width="70%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td>username:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>password:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td align="left" valign="top">&nbsp;</td>
<td><input type="submit" value="submit"></td>
</tr>
</table>
</form>
Which submit to the Validate.php below

PHP Code:
<?
session_start
();

// Connect to the database server 
   
$dbcnx = @mysql_connect("localhost""cash""****");
   if (!
$dbcnx) { 
     echo( 
"<p>Unable to connect to the " 
           
"database server at this time.</p>" ); 
     exit(); 
   } 

// Select the database
   
if (! @mysql_select_db("needforcash_com") ) { 
     echo( 
"<p>Unable to locate the " .
           
"database at this time.</p >" ); 
     exit(); 
   }

// Conver to simple variables
$username $_POST['username'];
$password $_POST['password'];

if((!
$username) || (!$password)){
    echo 
"Please enter ALL of the information! <br />";
    
header("Location: login.php");
    exit();
}

// check if the user info validates the db
$sql mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");
$login_check mysql_num_rows($sql);

if(
$login_check 0){
                     
$_SESSION['username'] = $username;
                     
$_SESSION['password'] = $password;
                     
$_SESSION['emailaddress'] = $emailaddress;
                     
$_SESSION['country'] = $country;
                     
$_SESSION['firstname'] = $firstname;
                     
$_SESSION['lastname'] = $lastname;
                     
mysql_query("UPDATE users SET lastlogin=now() WHERE username='$username'");
                     
header("Location: login_success.php");
}
else {
         echo 
"You could not be logged in! Either the username or password are not correct<br />
    Please try again!<br />"
;
    
header("Location: login.php");
}

?>
If the member is validated, he/she is taken to login_success.php page. This is a simple welcome page with one line that asks people to "click here to change their info". This is login_success.php

PHP Code:
<?
include ("verifylogin.php");
?>

<html>
<head>
<title></title>
</head>
<body>
<a href="info.php">Click here to update your information</a>
</body>
</html>
As you can see, the above script INCLUDEs VerifyLogin.php which is:

PHP Code:
<?
session_start
();
if(empty(
$_SESSION['username'])) {
die(
'An error has ocurred. You have not logged in, or your session has expired. Try <a href="login.html">loggin in</a>again.');
}
?>
Anyway, when the member in the login_success.php page clicks the link to change his personal info, he will be directed to info.php. In there, they will find this form:

HTML Code:
<form name="changeinfo" method="post" action="updateinfo.php">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td width="24%" align="left" valign="top">First Name</td>
<td width="76%"><input name="firstname" type="text" value="<? echo $firstname; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Last Name</td>
<td><input name="lastname" type="text" value="<? echo $lastname; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Email Address</td>
<td><input name="emailaddress" type="text" value="<? echo $emailaddress; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">password</td>
<td><input name="password" type="text" value="<? echo $password; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Country</td>
<td><input name="country" type="text" value="<? echo $country; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">&nbsp;</td>
<td><input type="submit" name="Submit" value="update"></td>
</tr>
</table>
</form>
The above form is the problem. The fields are empty EXCEPT the password field, which displays the password just fine! I don't know what's wrong with the other fields!

What do you think?

PS: I'm using PHP 4.2.2, and the Register Globals "suppose" to be on (I think).

Thanks. I appriciate any help you guys can give me.

Jimmy.