awarraic
asked on
How do I enable session variables in WAMP5 2.0
Session variables are not working at all in WAMP5, any suggesions?
thanks.
thanks.
Have you done session_start(); ???
ASKER
Yes I did.
Here are three pages that I have.
Page 1 - login page ---------- login in and sending the lgoin info to page 2
<form action="auth.php" method="gett">
Please Log In
<label for="user_name">Username* </label>
<input type="text" name="user_name" id="user_name" />
<label for="user_password">Passwo rd*</label >
<input type="password" name="user_password" id="user_password" />
<input type="submit" name="submit" id="submit" value="submit" />
</form>
Page 2 -------------------------- ----- setting up the session variables
<?php
$input_username = $_GET['user_name'];
$input_password = $_GET['user_password'];
$_SESSION["authenticate"] = $input_username;
$_SESSION["password"] = $input_password;
header("Location:mainAdmin .php");
?>
page 3 ---------------------- printing out passed session values
<?php session_start();
echo "test 1 = ";
echo $_SESSION["authenticate"];
echo $_SESSION["password"];
?>
Here are three pages that I have.
Page 1 - login page ---------- login in and sending the lgoin info to page 2
<form action="auth.php" method="gett">
Please Log In
<label for="user_name">Username* </label>
<input type="text" name="user_name" id="user_name" />
<label for="user_password">Passwo
<input type="password" name="user_password" id="user_password" />
<input type="submit" name="submit" id="submit" value="submit" />
</form>
Page 2 --------------------------
<?php
$input_username = $_GET['user_name'];
$input_password = $_GET['user_password'];
$_SESSION["authenticate"] = $input_username;
$_SESSION["password"] = $input_password;
header("Location:mainAdmin
?>
page 3 ---------------------- printing out passed session values
<?php session_start();
echo "test 1 = ";
echo $_SESSION["authenticate"];
echo $_SESSION["password"];
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oh and by the way you need to make session_start(); one of the first lines of code you write. And I am unsure but I don't think you can echo or print any thing before that line of code...
You also have to include session_start(); on page 2 prior to setting the session variables.
ASKER
Yea sorry, have that session_start(); on page 2, just mistypoed in here when I cleaned the code a lil bit.
ASKER
Thanks much.