Jump to content


This topic is now archived and is closed to further replies.


Sessions Keep Changing

Recommended Posts

I am trying to create a script with a multidimensional array. On each form submission, a new element is added to the array with the form info.

The problem is that every time the form is submitted, a new session is created. I have looked online, but I can't seem to find the answer to this specific problem. I have two other pages that operate in the same way without any problems.

I'm sure the answer is simple, but I'm just too frustrated to see it.

Thanks in advance

Here's the code...

print session_id()." session id<br />";
print "<br />";
print count($_SESSION['multi'])." count - session MULTI<br />";
print "<br />";
$_SESSION['multi']= array();

if (array_key_exists('_submit_check', $_POST)) {

$multiProduct = $_POST['multiProduct']; //put form elements into variables
$multiSize = $_POST['multiSize'];
$multiQuantity = $_POST['multiQuantity'];
$trioColor = $_POST['trioColor'];
$trioQuantity = $_POST['trioQuantity'];

if ($multiProduct ==1)
$multiProduct1 = $_POST['hTrio1'];
$multiProduct2 = $_POST['hTrio2'];
$multiProduct3 = $_POST['hTrio3'];

if ($multiProduct ==2)
$multiProduct1 = $_POST['vTrio1'];
$multiProduct2 = $_POST['vTrio2'];
$multiProduct3 = $_POST['vTrio3'];

if ($multiProduct ==3)
$multiProduct1 = $_POST['hMulti1'];
$multiProduct2 = $_POST['hMulti2'];
$multiProduct3 = $_POST['hMulti3'];

if ($multiProduct ==4)
$multiProduct1 = $_POST['vMulti1'];
$multiProduct2 = $_POST['vMulti2'];
$multiProduct3 = $_POST['vMulti3'];

foreach ($formArray as $tempArray)
print $tempArray;
print "<br />";
$_SESSION['multi'][] = $formArray;

foreach ($_SESSION['multi'] as $tempArray)

if($tempMultiArray[0] == 1 || $tempMultiArray[0] == 2)
print $key." Trio<br />";

print $key." Multi<br />";

print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Your First Pose is: '.$tempMultiArray[1] . "<br />\n";
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your Second Pose is: '.$tempMultiArray[2] . "<br />\n";
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your Third Pose is: '.$tempMultiArray[3] . "<br />\n";
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Product Quantity is: '.$tempMultiArray[4] . "<br />\n";

if($tempArray[0] == 1 || $tempArray[0] == 2)
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Trio Style: '.$tempMultiArray[5] . "<br />\n";

print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MultiSize: '.$tempMultiArray[5] . "<br />\n";

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.