Forum Moderators: coopster
First file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body>
<form name="form1" method="post" action="hee.php">
<p>
<input name="textfield" type="text" id="textfield">
Test, wee<br>
<input name="textfield2" type="text" id="textfield2">
<br>
<input type="submit" name="Submit" value="Submit Test">
</p>
</form>
</body>
</html>
<?PHP
session_start();
include 'includes/dbconnect.inc.php';
$name = $_POST['textfield'];
$pass = $_POST['textfield2'];
$query="SELECT * FROM Mendon WHERE owner='$name' and count_id='$pass'";
$result=mysql_query($query);
$num_rows = mysql_num_rows($result);
if ($num_rows!= 0) {
$_SESSION['name'] = $name;
$_SESSION['pass'] = $pass;
global $_SESSION;
echo "Session made!".$_SESSION['name']."<a href='gah2.php'>Click here to test!</a>";
} else {
echo "Wrong info!";
}
?> The session was viewable in that last file, the final PHP file: <?
session_start();
$name = $_SESSION['name'];
$pass = $_SESSION['pass'];
$name2 = "Ha!";
$nametest = $_SESSION['name'];
echo "Testing: ".$nametest." or ".$name2;
?> The $name2 WON'T SHOW UP! So apparently the session isn't carrying over. >.< Any ideas?
If register_globals is disabled, only members of the global associative array $_SESSION can be registered as session variables. The restored session variables will only be available in the array $_SESSION.