PHPClueless
Dec 7th 2006, 9:19 am
Hi! Thanks in advance to anyone who can answer this. I have a session variable (empcode) that isn't getting across.
A snippet from the first page where employees enter their username (empcode) and password (password), with HTML tags and other formatting removed:
<form action="employeeinformationmenu.php" name="leave" method="post" onSubmit="return validateForm(leave);">
Employee Number:
<input name="empcode" type="text" onSubmit="return validateForm(leave);"/>
Password:
<input name="password" type="password" / onSubmit="return validateForm(leave);">
<?php
session_register("empcode");
session_register("password");
?>
This part works great. They enter their employee number and password.
Page 2
At the top:
<?php
session_start();
$_SESSION['empcode'] = $_POST['empcode'];
$_SESSION['middle'] = $_POST['middle'];
$_SESSION['firstname'] = $_POST['firstname'];
$_SESSION['lastname'] = $_POST['lastname'];
$_SESSION['leavehours'] = $_POST['leavehours'];
$_SESSION['password'] = $_POST['password'];
header('Content-Type: image/jpeg');
?>
This works fine, as well. It pulls the info it's supposed to pull.
I want to take the username and password already *allegedly* in the session, and send them to the next page using:
<form action="paystubresults.php" name="paystubs" method="post">
<input type="submit"/ value="Paystubs">
</form>
Page 3
At the top:
<?php
session_start();
$empcode = $_SESSION['empcode'];
$middle = $_SESSION['middle'];
$firstname = $_SESSION['firstname'];
$lastname = $_SESSION['lastname'];
$leavehours = $_SESSION['leavehours'];
$password = $_SESSION['password'];
?>
<?php
echo '<pre>' . print_r($_SESSION,true) . '</pre>';
echo $password;
?>
The above echo statements give me:
Array
(
[empcode] =>
[password] => 123456789 (changed, was my real SSN)
[middle] =>
[firstname] =>
[lastname] =>
[leavehours] =>
)
123456789 (changed, was my real SSN)
So it carries the password over, but not the employee number (empcode).
Anybody?
A snippet from the first page where employees enter their username (empcode) and password (password), with HTML tags and other formatting removed:
<form action="employeeinformationmenu.php" name="leave" method="post" onSubmit="return validateForm(leave);">
Employee Number:
<input name="empcode" type="text" onSubmit="return validateForm(leave);"/>
Password:
<input name="password" type="password" / onSubmit="return validateForm(leave);">
<?php
session_register("empcode");
session_register("password");
?>
This part works great. They enter their employee number and password.
Page 2
At the top:
<?php
session_start();
$_SESSION['empcode'] = $_POST['empcode'];
$_SESSION['middle'] = $_POST['middle'];
$_SESSION['firstname'] = $_POST['firstname'];
$_SESSION['lastname'] = $_POST['lastname'];
$_SESSION['leavehours'] = $_POST['leavehours'];
$_SESSION['password'] = $_POST['password'];
header('Content-Type: image/jpeg');
?>
This works fine, as well. It pulls the info it's supposed to pull.
I want to take the username and password already *allegedly* in the session, and send them to the next page using:
<form action="paystubresults.php" name="paystubs" method="post">
<input type="submit"/ value="Paystubs">
</form>
Page 3
At the top:
<?php
session_start();
$empcode = $_SESSION['empcode'];
$middle = $_SESSION['middle'];
$firstname = $_SESSION['firstname'];
$lastname = $_SESSION['lastname'];
$leavehours = $_SESSION['leavehours'];
$password = $_SESSION['password'];
?>
<?php
echo '<pre>' . print_r($_SESSION,true) . '</pre>';
echo $password;
?>
The above echo statements give me:
Array
(
[empcode] =>
[password] => 123456789 (changed, was my real SSN)
[middle] =>
[firstname] =>
[lastname] =>
[leavehours] =>
)
123456789 (changed, was my real SSN)
So it carries the password over, but not the employee number (empcode).
Anybody?