First of all, make sure you're doing session_start() before reading/writing any session data and before you do any output.

Second, You likely need to just do something like this:

session_start();
if(post data) {
  $_SESSION['formArray'][] = $_POST;
}

This will save each POST array as-is in the session.

Chris W. Parker wrote:

Kermit Short <mailto:[EMAIL PROTECTED]>
    on Friday, February 27, 2004 2:10 PM said:


I've got some code and it simply isn't working.  I thought it might be
because each time the form submits data, the array I'm storing
information in is being re-initialized.  If this is the case, I don't
have the multidimensional array I'm trying to get, but just a vector
array with the most recent submission data.


here are some thoughts...

sounds like you're just not keeping track of each iteration. i mean,
within the session variable you need to somehow differentiate between
each subsequent form submittal.

<?php

$iteration = ++$_POST['iteration'];

$_SESSION['post_data'][$iteration] = $_POST;

  // include $iteration in the post data
  // so that next time it comes around
  // it can be incremented.
  echo <<<QQQ

<form method="post" action="myself">
 ...
 <input type="hidden" name="iteration" value="$iteration" />
 ...
</form>

?>

you should then see a multi-dimensional array with
'print_r($_SESSION);'.

this code is untested and not very complete. ;) but maybe it will give
you some ideas?


hth, chris.


--
paperCrane <Justin Patrin>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to