I am asking a similar question to one I asked yesterday (which received no
answers) with more information in the hopes someone will be kind enough to
guide me.

I have an order form populated with an array (as opposed to a database
table). The user can enter quantities, and the form posts all the
information to the order_process page where the values they entered are
listed for review.

I decided I wanted to allow them to edit quantities before actually
submitting the form (by which I mean before using the mail() function).

I found that $_SESSION is the way to go.

On the order summary page (order_process.php), I start a session and I get
all the POST information via:

[code]

session_start();

extract($_POST);

[/code]

Instead of echoing the quantity values of each item, I populate an input
field with them within an echo:

[code]

//when this function is called, $a is a the quantity variable $show_01_qty
function writeResultRow($a, $b, $c, $d, $e, $f) {
 if($a != '') {
  echo "<tr><input type='text' value=' " . $a . " ' name=' " . $a . " ' id='
" . $a . " ' size='2' /></td>";
  . . .
}
[/code]

Now, in order to update a quantity, the user replaces the quantity in the
input field with the new number, and clicks a submit button which posts to
order_update.php.

I have the following code for order_update.php:

[code]

session_start();
extract($_POST);
foreach ($_POST as $var => $val) {
 if ($val > 0) {
  $_SESSION[$var] = $val;
 } else {
  unset($var);

 }
 header("Location: order_process.php");
}

[/code]

This is not working, however, and it just loads order_process.php with no
values for the varaibles, as if I just refreshed the page with no sessions.

Help please!

Reply via email to