mister_t101 Posted May 1, 2006 Share Posted May 1, 2006 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 advanceHere'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 ' Your First Pose is: '.$tempMultiArray[1] . "<br />\n"; print ' Your Second Pose is: '.$tempMultiArray[2] . "<br />\n"; print ' Your Third Pose is: '.$tempMultiArray[3] . "<br />\n"; print ' Product Quantity is: '.$tempMultiArray[4] . "<br />\n"; if($tempArray[0] == 1 || $tempArray[0] == 2) { print ' Trio Style: '.$tempMultiArray[5] . "<br />\n"; } else { print ' MultiSize: '.$tempMultiArray[5] . "<br />\n"; } } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.