OK, let me provide some code... Sorry about that.
So I have a basic html form and I pull data from that with instruments.php shown below:
The snippet:
<?php
include_once($modx->config['base_path'].'assets/quoteForm/scripts/instruments.php');
?>
here is instruments.php
<?php
require_once "HTML/Template/IT.php"; //pear template class
require_once "functions.php"; //my functions
session_start(); //start/continue the session
$formConnect = connectAndSelect(); //connect to database
$contactInfo = array();
$contactInfo['FirstName'] = $_REQUEST['FirstName'];
$contactInfo['LastName'] = $_REQUEST['LastName'];
$contactInfo['CompanyName'] = $_REQUEST['CompanyName'];
$contactInfo['Address'] = $_REQUEST['Address'];
$contactInfo['Address2'] = $_REQUEST['Address2'];
$contactInfo['City'] = $_REQUEST['City'];
$contactInfo['State'] = $_REQUEST['State'];
$contactInfo['Zip'] = $_REQUEST['Zip'];
$contactInfo['Phone'] = $_REQUEST['Phone'];
$contactInfo['Email'] = $_REQUEST['Email'];
$contactInfo['Application'] = $_REQUEST['Application'];
/************************
I took out all the PEAR code because it really does not matter
*************************/
mysql_close($formConnect);
//$template->show(); //show template with pear
header("Location: http://tautheta.in-situ.com/assets/quoteForm/scripts/instrumentInfo.php");
?>
At this point so far everything works just fine. But when I redirect to the instrumentInfo.php script....
<?php
session_start();
$productQty = $_SESSION['productQty'];
$contactInfo = $_SESSION['contactInfo'];
//if user has no contact info set, redirect them to the beginning of the form
if (!(isset($_SESSION["contactInfo"]))){
die("ERROR: contact info session var not set....");
}
else if (!isset($_REQUEST["instrument"]))
die("Please go back and select an instrument before proceeding. Thank you!");
else
$instrument = $_REQUEST['instrument'];
$_SESSION["instrument"] = $instrument;
$productQty[(string)$instrument] = 1;
//...
//There is more code here but it doesn't really matter
?>
I set the $_SESSION[’contactInfo’] to the local variable $contactInfo, and when I test to see if $contactInfo is set, it fails. When I tested this outsite of MODx, it worked just fine. I suppose I could make instrumentInfo.php in to a snippet, but including instrumentInfo.php, but I don’t think that would really matter. So why is $_SESSION[’contactInfo’] not set?