I've searched around this board and google a bunch of times and I can't seem to get this to work. Here's the premise:
I've got one php page that creates an object. After the user submits a form on that page they are redirected to another page that needs to recieve that object from the previous page. How do I accomplish this?
Here's the php code from the first page (step2.php):
<?php
session_start();
require_once("Listing.class.php");
require_once("variables.php");
$newListing = new Listing;
$newListing->setPrice($_POST['price']);
$newListing->setMLS($_POST['mls']);
$newListing->setTitle($_POST['title']);
$_SESSION['newListing'] = $newListing;
?>
then it displays the form the user needs to fill out. When they click the submit button, the action points to this page (addListing.php):
<?php
session_start();
require_once("Listing.class.php");
require_once("variables.php");
$newListing = null;
if(isset($_SESSION['newListing']))
{
$newListing = $_SESSION['newListing'];
echo "Session Active.";
echo $newListing->getTitle();
}
else
echo "Session Ended.";
?>
I've also tried serializing/unserializing the object and that also doesn't work. I'm sure I'm probably doing something really stupid, but alas, it's my first time messing around with sessions :bemused:
Thanks
Steve