Hi all --
I'm trying to do the basic data entry into an HTML forum, run a check, and if incorrect, go back to the original page, with all values that were entered, remembered. I'm trying to use sessions to do this, but am having some trouble.
Page1:
<?php
//START SESSION
session_start();
?>
<html>
<center>
<table width="700" border="0" cellspacing="0" cellpadding="0" height=500>
<tr>
<td valign=top height=450 width="200">
<img src="images/sp.gif">
</td>
<td valign="top" height="450" width="500">
<!--TEXT GOES HERE-->
<form method="post" form action="newUserSubmit.php">
Email:<br>
<input type="text" name="email" value=<? $_SESSION['email']; ?>><br><br>
First Name:<br>
<input type="text" name="fname"><br><br>
Last Name:<br>
<input type="text" name="lname"><br><br>
Phone:<br>
<input type="text" size="3" name="phone1">
<input type="text" size="3" name="phone2">
<input type="text" size="4" name="phone3"><br><br>
Desired User Name:<br>
<input type="text" name="user"><br><br>
Password:<br>
<input type="password" name="pass"><br><br>
Re-type Password:<br>
<input type="password" name="passVerify"><br><br>
<input type="submit" value="Sign up" class="button">
<input type="reset" value="Clear" class="button">
</form>
</td>
</tr>
</table>
</center>
Currently, only the email field has the $_SESSION['email'] argument in it, just testing. However, none of the input gets transferred back on the redirect.
Page1 gets submitted to Page2 below:
<?php
//START SESSION
session_start();
include 'misc.inc';
include 'connect.php';
include 'functions.php';
//GLOBAL VARIABLES
$fname = $_POST[fname];
$lname = $_POST[lname];
$phone = $_POST[phone1] . "-" . $_POST[phone2] . "-" . $_POST[phone3]; // phone1 area code phone 2 prefix phone 3 last four
// posting phones separately so each can be assigned a separate session variable
$phone1 = $_POST[phone1];
$phone2 = $_POST[phone2];
$phone3 = $_POST[phone3];
$email = $_POST[email];
$passSlash1 = $_POST[pass];
$passSlash2 = $_POST[passVerify];
$pass = stripslashes($passSlash1); //this strips the slashes so it is nicely formatted for the email
$passVerify = stripslashes($passSlash2); //this strips the slashes so it is nicely formatted for the email
$userSlash = $_POST[user];
$user = stripslashes($userSlash);
//SESSION VARIABLES, where variable in brackets is a NEW assigned session name
$_SESSION['fname'] = $fname;
$_SESSION['lname'] = $lname;
$_SESSION['phone1'] = $phone1;
$_SESSION['phone2'] = $phone2;
$_SESSION['phone3'] = $phone3;
$_SESSION['email'] = $email;
$_SESSION['user'] = $user;
// pass variables $pass and $passVerify to function, to function properly
verifyPassword($fname, $lname, $phone1, $phone2, $phone3, $email, $user, $pass, $passVerify);
?>
In the above page, a the function verifyPassword() is called, below is the page where it is defined:
<?php
session_start();
// pass the arguments $pass and $passVerify to the function
function verifyPassword ($fname, $lname, $phone1, $phone2, $phone3, $email, $user, $pass, $passVerify)
{
if ($pass != $passVerify)
{
header("Location: newUser.php");
}
}
?>
Any ideas why the value the user inputted in the email field is not getting passed back after the redirect? Thanks very much for any input!