Basically what i am trying to do here is have a user enter a classified in my form and post it to the website. If the user does not have a current login then i want to store the form data in an object of storeAuto class. After the user logs in I want to call the post function which is a method of the storeAuto class to post the object's variables.
I cant print or access any of the variables stored in $_SESSION['storeAuto'].
I am trying to echo it out by: $_SESSION['storeAuto']->year
But that wont work at all
I hope you can help
include_once($_SERVER['DOCUMENT_ROOT'] . "Zebrick/bin/globalOP.php");
include_once($PATH_TO_FUNC);
include_once($PATH_TO_CLASSES);
include_once($PATH_TO_COOKIE);
// Environment Variables
$styleArray = array('2DR Coupe','4DR Sedan','Convertible','Conversion Van','Minivan/Van','SUV','4WD/AWD','Truck','Sport Car','Motorcycle','Other');
$year = 0;
if( $_POST['Submit'] ) {
// Strip tags from user input
$year = strip_tags($_POST['year']);
$manufactr = trim(strip_tags($_POST['manufactr']));
$model = trim(strip_tags($_POST['model']));
$style = strip_tags($_POST['style']);
$description = trim(strip_tags($_POST['description']));
$dollars = strip_tags($_POST['dollars']);
$cents = strip_tags($_POST['cents']);
$price = $dollars . "." . $cents;
$email = trim(strip_tags($_POST['email']));
$zip = strip_tags($_POST['zip']);
if( curseFind("",$_POST) !== false )
$errorStr = "One/More of the submitted characteristics contains vulgar material, which will not be tolerated by Zebrick.";
elseif( empty($manufactr) )
$errorStr = "The manufacturer must be submitted in order to place classified.";
elseif( empty($model) )
$errorStr = "The model must be submitted in order to place classified.";
elseif( empty($description) )
$errorStr = "The description must be submitted in order to place classified.";
elseif( strlen($description) > $descLimit )
$errorStr = "The description field must contain less than 200 characters.";
elseif( !is_numeric($dollars) )
$errorStr = "The dollar field must be a number between 1 and 99999.";
elseif( !is_numeric($cents) )
$errorStr = "The cents field must be a number between 0 and 99.";
elseif( empty($email) )
$errorStr = "The e-mail field must be submitted in order to place classified.";
elseif( !checkEmail($email) )
$errorStr = "The e-mail field must be in the correct format: [email]someone@domain.com[/email]";
elseif( strlen($zip) < 5 )
$errorStr = "The zip code field must contain five(5) digits.";
else {
// If login is required send to register page
if( loginReq() ) {
// Create storeAuto object from post variables
$_SESSION['storeAuto'] = new storeAuto($year,$manufactr,$model,$style,$description,$dollars,$price,$email,$zip);
// Redirect to login page
header("Location: ../../myZebrick/login.php");
} else { // No errors and user is logged in
// Open database connection
require($PATH_TO_CONN);
// Insert in table
mysql_query("INSERT INTO auto (id_user,ts_placed,ts_expire,confirmed,year,manufactr,model,style,description,price,email,zip) VALUES
('$_SESSION[id_user]',now(),DATE_ADD(now(),INTERVAL 1 MONTH),0,'$year','$manufactr','$model','$style','$description','$price','$email','$zip')",$zebrick) or
die(mysql_error());
// Redirect to Confirmation Page
header("Location: viewAuto.php");
} // End Else of Error Checking
} // End Error Checking If...Else If...Else Structure
} // End If Submit If Structure
?>