I understand the basics of $_SESSION vars in php. I currently have a site that passes several values to and from pages that manage SQL queries throughout. I ran into a new problem:
I am using an email address as a Primary Key in my users table. I wish to pass this email to a second page (once the additional infomration is gathered from the server) and dynamically load content when the links are selected. This is my setup for my problem:
//Data returned from server: // $FName = bob, $LName = rogers, $Email = bob@rogers.com
$_SESSION['userEmail'] = $Email;
$_SESSION['FirstName'] = $FName;
$_SESSION['LastName'] = $LName;
When I load the content on the second page, I recieve these values:
echo $_SESSION['userEmail']; //bob@rogers_com !!!!! THIS is not correct
echo $_SESSION['FirstName']; //bob
echo $_SESSION['LastName']; //rogers
The email is gathered from a POST form on the page. it is the only value within the form. On the first page, I retrieve the email using end(array_keys($_POST)), which is where "$_SESSION['userEmail'] = $Email" comes from. It is, more specifially, :: $_SESSION['userEmail'] = end(array_keys($_POST))::
How do I make it so the Email is passed safely through the request without being transformed?
After further troubleshooting, I have been able to determine that this transformation occurs in the POST request of the form. When clicked the form is using the POST method, which is intercepted in PHP using if($_SERVER['REQUEST_METHOD'] == 'POST'){}, where I capture the array of values (in my case, just the one email) - where the email is now transformed.