I have a multi page form that I am trying to implement on my website which works like so:
1 Enter details of customer -- $_POST --> 2 Confirm Customer Details --$_SESSION--> 3 Generate PDF from Customer Details
As you can see on my second page I get the values in my form from $_POST. On that same page I create an object called "customer" from my class called customer which stores all the values POSTed from my first page.
I then set a $_SESSION variable called "customer" and assign it to my object.
session_start();
//includes html header part of page
include("includes/page/header.php");
//customer class
include("classes.php");
$customer = new customer();
$_SESSION['customer'] = $customer;
Now on my final page of my site I have the following code:
session_start();
//assign customer to equal object stored in session
$customer = $_SESSION['customer'];
//to test if successfull , nothing is displayed!
echo $customer->first_name;
return 0;
Testing this nothing is displayed on my page, so my session is not doing what I thought it would do.
FYI:
- My class customer is fine and works properly and stores all values correctly!
- My post array is working fine
var_dump of session on final page.
object(__PHP_Incomplete_Class)#1 (15) { ["__PHP_Incomplete_Class_Name"]=> string(8) "customer" ["first_name"]=> string(5) "Iain" ["second_name"]=> string(6) "Taylor" ["company_name"]=> string(10) "Wired Ltd." ["address_1"]=> string(15) "14 Joseph St" ["address_2"]=> string(8) "West End" ["city"]=> string(7) "Glasgow" ["postcode"]=> string(7) "G45 NP4" ["county"]=> string(29) "Scotland" ["country"]=> string(14) "United Kingdom" ["email"]=> string(31) "somebody@somebody.com" ["phone"]=> NULL ["cid"]=> NULL ["reg_date"]=> NULL ["tel"]=> string(11) "01413395678" }
Any ideas how to get this to work ?
Thanks
Merry Christmas!