Hi,
Learning PHP, XP Pro/SP2, Apache local server, PHP5.2.5. No relevant past similar language experience.
I'm having a devil of a time! I have two session variables and 3 pages I want to use them on. Of one particular pair, one works across all 3 pages, the other only across the first 2 pages; 3rd page doesn't "see" it.
With the exception that one is numeric and the other an e-mail address, after validation, I simply can NOT see why the e-mail address isn't availble to the 3rd page.
Structure: Captcha-like (but no image, just a few questions) page and e-mail address input/confirmation e-mail input.
Structure:
-- Page 1: Enter, data to use to validate human vs. robot etc.
-- Page 2: Success/error page and 3 links to one of 3 different forms upon success.
-- Page 3: One of the 3 available forms for the visitor input.
A quick 'pop-quiz' check here is to ask for 'age' and compare it to what was entered back on page 1.
The email address "$eml" isn't available on page 3; while age is.
'age' and 'eml' are entered on page 1, using identical '<input ... ' formats. 'age' is made available on page 3, but 'eml' is not available on page 3; somehow I'm screwing it up.
Here's the relevant code below. I've shown only what I think is relevant code; there IS validation in the form of 'FILTER_VALIDATE_EMAIL', which is "fixed" in this rev, though I'm fairly sure it has nothign to do with my issues. No validation is done on "age"; it's for later use.
I can post more complete code if it's deemed necessary:
Entry page:
Code: Select all
<?php
# SessionPage1.php
# Original from: Dr. Herong Yang, http://www.herongyang.com/
# Written in PHP 5.2.5 on XP Pro SP2 & local Apache server
#
session_start();
$pw=mt_rand(x,y). mt_rand(x,y)*3; // random password generator
$_SESSION['pw']=$pw; // pw for use as access number below
$_SESSION['age']=$age; // OK; WORKING on check1.php
$_SESSION['eml']=$eml; // OK ON check1.php, NOT OK; NOT WORKING on spca.php
if (isset($_SESSION['count'])) {
$count = $_SESSION['count'];
} else {
$count = 0;
}
$count++;
$_SESSION['count'] = $count;
<form
Enter a valid e-mail address here:<br><input type=text name="eml">
...
Code: Select all
<?php
# check.php
session_start();
$pw = $_SESSION['pw']; // This was assigned in 1
$age=$_SESSION['age'];
$eml=$_SESSION['eml'];
$count = $_SESSION['count'];
$count++;
$_SESSION['count'] = $count;
# ERROR SET
$error=0;
#
?> <meta name="robots" content="noindex, nofollow">
<?php
echo "eml is " . $_POST['eml']; // OK HERE; *NOT OK* ON spca.php
echo "Age is " . $_POST['age']; // OK HERE; OK ON spca.php
One of the 3 possible forms linked to in above:
Code: Select all
<?php
session_start();
$pw = $_SESSION['pw']; // This was assigned in 1
$age=$_SESSION['age'];
$eml=$_SESSION['eml'];
$count = $_SESSION['count'];
$count++;
$_SESSION['count'] = $count;
# ERROR SET
$error=0;
#
?> <meta name="robots" content="noindex, nofollow">
<?php
echo "eml is " . $eml;
echo "eml is " . $_POST['eml'];
?>
Thanks for reading; usually it's something simple or stupid I've done when it comes to this sort of thing but damned if I can figure it out!
Twayne