noob alert
Okay, so I have a form and the information from that form in the db. At login it goes to a members area type of page and I'm trying to display the user's email and zipcode.
By the way, the db connection is being made and the session started in the base.php which is being included, that works fine. I can get all the info in email and zipcode but not just the zip of the current user.
This code won't display the email or the zip but will show that the user is logged in. I think its something to do with my query
<?php include "base.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Areups</title>
<style type="text/css">
@import url("../forHeader.css");
@import url("../landingCSS.css");
</style>
</head>
<body>
<?php
if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['email']))
{
?>
<a href = logout.php>Log out</a>
<h1>Member Area</h1>
<p>Thanks for logging in! </p>
<?php
$user = "SELECT * FROM userInformation WHERE email = '".$email."'";
$userResult = mysql_query($user) or die(mysql_error());
while($row = mysql_fetch_array($userResult))
{
$email= $row["email"];
$zipcode = $row["zipcode"];
echo "$email ";
echo " @ $zipcode";
}
?>
<?php
}
else if(!empty($_POST['email']) && !empty($_POST['password']))
{
$email = mysql_real_escape_string($_POST['email']);
$password = md5(mysql_real_escape_string($_POST['password']));
$checklogin = mysql_query("SELECT * FROM userInformation WHERE email = '".$email."' AND password = '".$password."'");
if(mysql_num_rows($checklogin) == 1)
{
$row = mysql_fetch_array($checklogin);
$email = $row['email'];
$_SESSION['email'] = $email;
$_SESSION['LoggedIn'] = 1;
echo "<h1>Success</h1>";
echo "<p>We are now redirecting you to the member area.</p>";
?>
<meta http-equiv="refresh" content="0"> ;
<?php
}
else
{
echo "<h1>Error</h1>";
echo "<p>Sorry, your account could not be found. Please <a href=\"register.php\">click here to register</a>.</p>";
}
}
else
{
?>
<h1>Member Login</h1>
<p>Thanks for visiting! Please either login below, or <a href="../register.php">click here to register</a>.</p>
<form method="post" action="../landingPage.php" name="loginform" id="loginform">
<fieldset>
<label for="email">Email:</label><input type="text" name="email" id="email" /><br />
<label for="password">Password:</label><input type="password" name="password" id="password" /><br />
<input type="submit" name="login" id="login" value="Login" />
</fieldset>
</form>
<?php
}
?>
</div>
</body>
</html>