title: Promo code form unsetting user registration data
body: <p>The code below has 8 $_POST variables containing user registration data. The code below also features a promo code text field, when users enter a promo code and try to update, I lose the values of the 8 $_POST variables that contained user registration data. I was wondering if there was a way to not lose that data?</p>
  
  <pre><code>&lt;?php
      session_start();
  
      //Create mysql connect variable
      $conn = mysql_connect('host', 'root', 'raycharles');
  
      //kill connection if error occurs
      if(!$conn){
          die('Error: Unable to connect.' . '&lt;br&gt;' . mysql_error());
      }
      //connect to mysql database
      mysql_select_db("wibldard", $conn);
  
  
  
      //GET PROMO CODES FROM DB
      $promo_results = mysql_query("SELECT * FROM promo",$conn);
  
      while($promo_row = mysql_fetch_array($promo_results)){
          echo $promo_row['promo_code'];
      }
  
      if(isset($_GET['promo'])){
          echo $_GET['promo'];
      }
      ?&gt;
  
      &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  
      &lt;!-- JAVASCRIPT --&gt;
      &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;
  
      &lt;!-- STYLES &amp; FONTS --&gt;
      &lt;link rel="stylesheet" type="text/css" href="css/style.css" /&gt;
  
      &lt;!--JQUERY--&gt;
      &lt;script type="text/javascript"&gt;
      $(document).ready(function(){
          $("#mainsearchfield").Watermark("");
      });
  
      &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="main-container"&gt;
  &lt;?php include('inc/menu.inc.php'); ?&gt;
  
  &lt;div id="body-container" style="padding-bottom:150px; height:800px;"&gt;
      &lt;div style="height:100px; margin:0px auto;"&gt;
          &lt;img class="reg-step" style="width:100%;" src="images/step2.png"&gt;
      &lt;/div&gt;
  
      &lt;?php
          //echo 'e-mail :' . $_POST['email'] . '&lt;br/&gt;' . 'password :' . $_POST['password'] . '&lt;br/&gt;' .  'city: ' . $_POST['city'] . '&lt;br/&gt;' .  'state: ' . $_POST['state']  . '&lt;br/&gt;' . 'phone: ' .  $_POST['phone'] . '&lt;br/&gt;' .  'first name: '. $_POST['fname'] . '&lt;br/&gt;' .  'last name: ' . $_POST['lname'] . '&lt;br/&gt;company: ' . $_POST['company-name'] ;
          $_SESSION['email'] = $_POST['email'];
          $_SESSION['password'] = $_POST['password'];
          $_SESSION['city'] = $_POST['city'];
          $_SESSION['state'] = $_POST['state'];
          $_SESSION['phone'] = $_POST['phone'];
          $_SESSION['first'] = $_POST['fname'];
          $_SESSION['last'] = $_POST['lname'];
          $_SESSION['compname'] = $_POST['compname'];
      ?&gt;
  
      &lt;span style="font-size:22px; color:blue; font-weight:bold; margin-left:100px;"&gt; Invoice &lt;/span&gt;
  &lt;div style="width:900px; height:500px; border:1px solid #ddd; margin-left:100px;"&gt; 
      &lt;table id="registration-table1"&gt;
          &lt;!-- Results table headers --&gt;
          &lt;tr style="background-color:lightblue;"&gt;
            &lt;th&gt;Date&lt;/th&gt;
            &lt;th&gt;Product&lt;/th&gt;
            &lt;th style="width:50px;"&gt;Qty&lt;/th&gt;
            &lt;th&gt;Cost&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td style="width:120px;"&gt;&lt;?php echo date("m/d/y");?&gt;&lt;/td&gt;
            &lt;td style="width:570px; text-align:left; padding-left:10px;"&gt;
                  &lt;a href="#"&gt;Apples&lt;/a&gt;
            &lt;/td&gt;
            &lt;td style="text-align:center; padding-bottom:120px;"&gt;1&lt;/td&gt;
            &lt;td style="width:150px; padding-bottom:120px; text-align:center;"&gt;$59.99&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;div style="float:left; width:350px; font-size:12px; padding:10px;"&gt;*An order confirmation e-mail will be sent out to the address provided upon payment authorization.&lt;/div&gt;
      &lt;table id="registration-table2"&gt; 
          &lt;tr&gt;
              &lt;td style="font-weight:bold; width:140px; padding:10px; padding-right:20px;"&gt;Promo Code:&lt;/td&gt;
              &lt;td class="table2-cell"&gt;
                  &lt;form method="get" action="registernewstep2.php"&gt;
                      &lt;input name="promo" style="width:90px; margin-right:7px; margin:5px;" type="text" /&gt;&lt;br/&gt;
                      &lt;input type="submit" style="margin-bottom:5px;" value="update"/&gt;
                  &lt;/form&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td class="table2-heading-cell"&gt;Delivery:&lt;/td&gt;
            &lt;td class="table2-cell"&gt;&lt;i&gt;Electronic&lt;/i&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td class="table2-heading-cell"&gt;Shipping:&lt;/td&gt;
            &lt;td class="table2-cell"&gt;$0.00&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td class="table2-heading-cell"&gt;Tax:&lt;/td&gt;
            &lt;td class="table2-cell"&gt;$0.00&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td class="table2-heading-cell"&gt;Total:&lt;/td&gt;
            &lt;td class="table2-cell"&gt;$59.99&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td style="font-weight:bold; padding:10px; border:none;"&gt;&lt;/td&gt;
            &lt;td style="text-align:center; border:none; padding-top:20px;"&gt;
              &lt;!--CHECKOUT BUTTON--&gt;
              &lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt;
                  &lt;input type="hidden" name="cmd" value="_xclick"&gt;
                  &lt;input type="hidden" name="business" value="johnnycage9@gmail.com"&gt;
                  &lt;input type="hidden" name="lc" value="US"&gt;
                  &lt;input type="hidden" name="item_name" value="apples"&gt;
                  &lt;input type="hidden" name="item_number" value="1701"&gt;
                  &lt;input type="hidden" name="amount" value="1.00"&gt;
                  &lt;input type="hidden" name="currency_code" value="USD"&gt;
                  &lt;input type="hidden" name="button_subtype" value="services"&gt;
                  &lt;input type="hidden" name="no_note" value="0"&gt;
                  &lt;input type="hidden" name="tax_rate" value="0.000"&gt;
                  &lt;input type="hidden" name="shipping" value="0.00"&gt;
                  &lt;input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_SM.gif:NonHostedGuest"&gt;
                  &lt;input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_SM.gif" style="border:1px solid #fff;" name="submit" alt="PayPal - The safer, easier way to pay online!"&gt;
                  &lt;img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"&gt;
              &lt;/form&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  
  &lt;?php include('inc/footer.inc.php'); 
  
  echo'
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;';
  </code></pre>