Assistance with passing incremented data arrays using session variables arrays

Discussion in 'PHP' started by cspitzig, Nov 26, 2007.

  1. #1
    I am trying to create an order form that display database information and has an input field for the customer to indicates amounts, then send the arrays data to a confirmation page

    I can't create the session array to port over to the 2nd page

    can someone please review my code and give me some pointers on what I should be doing.

    
    
       for ($i = 0 ; $i < $rows ; $i++)  {
          ${"myrow$i"} = mysql_fetch_array($result);
          echo "<tr>\n";
    //      echo "\t<td>".${"myrow$i"}["id"]."</td>\n";
          echo "\t<td class=\"item\">".${"myrow$i"}["item"]."</td>\n";
          echo "\t<td class=\"cost\">".${"myrow$i"}["cost"]." each</td>\n";
          echo "\t<td class=\"amount\"><input type=\"text\" name=\"f_amount\" size=\"6\"></td>\n";
          echo "</tr>\n";
    
             if (!empty($f_amount)){
                ${"myrow$i"}[] = "$f_amount";
                  $_SESSION['${"myrow$i"}'] = ${"myrow$i"};
                //   print_r (${"myrow$i"});
          }
       }
    
    Code for initial page ends
    
    Code for receiving page starts
    
    if(!isset($_SESSION['${"myrow$i"}']))  {
         print 'array not working';
         }
        else {
           print_r (${"myrow$i"});
    }
    
    
    Code (markup):
    Also, I do have session_start at the top of the page
    any help would be greatly appreciated
     
    cspitzig, Nov 26, 2007 IP
  2. selling vcc

    selling vcc Peon

    Messages:
    361
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you show the entire code for the first page,


    Please use the PHP tags
     
    selling vcc, Nov 27, 2007 IP