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:





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


//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>";
  . . .

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

I have the following code for order_update.php:


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

 header("Location: order_process.php");


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