Jump to content


Photo

Sessions Keep Changing


  • Please log in to reply
No replies to this topic

#1 mister_t101

mister_t101
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 01 May 2006 - 08:46 PM

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...

php:
<?php
session_start();
print session_id()." session id<br />";
print "<br />";
print count($_SESSION['multi'])." count - session MULTI<br />";
print "<br />";
$_SESSION['checkFrameAll'];
$_SESSION['sessionFrameAll'];
$_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'];
}

$formArray=array($multiProduct,$multiProduct1,$multiProduct2,$multiProduct3);
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 />";
}

else
{
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";
}

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users