Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8199945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:16:30+00:00 2026-06-07T06:16:30+00:00

The code below has 8 $_POST variables containing user registration data. The code below

  • 0

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?

<?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.' . '<br>' . 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'];
    }
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>

    <!-- JAVASCRIPT -->
    <script type="text/javascript" src="js/jquery.js"></script>

    <!-- STYLES & FONTS -->
    <link rel="stylesheet" type="text/css" href="css/style.css" />

    <!--JQUERY-->
    <script type="text/javascript">
    $(document).ready(function(){
        $("#mainsearchfield").Watermark("");
    });

    </script>

</head>

<body>
<div id="main-container">
<?php include('inc/menu.inc.php'); ?>

<div id="body-container" style="padding-bottom:150px; height:800px;">
    <div style="height:100px; margin:0px auto;">
        <img class="reg-step" style="width:100%;" src="images/step2.png">
    </div>

    <?php
        //echo 'e-mail :' . $_POST['email'] . '<br/>' . 'password :' . $_POST['password'] . '<br/>' .  'city: ' . $_POST['city'] . '<br/>' .  'state: ' . $_POST['state']  . '<br/>' . 'phone: ' .  $_POST['phone'] . '<br/>' .  'first name: '. $_POST['fname'] . '<br/>' .  'last name: ' . $_POST['lname'] . '<br/>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'];
    ?>

    <span style="font-size:22px; color:blue; font-weight:bold; margin-left:100px;"> Invoice </span>
<div style="width:900px; height:500px; border:1px solid #ddd; margin-left:100px;"> 
    <table id="registration-table1">
        <!-- Results table headers -->
        <tr style="background-color:lightblue;">
          <th>Date</th>
          <th>Product</th>
          <th style="width:50px;">Qty</th>
          <th>Cost</th>
        </tr>
        <tr>
          <td style="width:120px;"><?php echo date("m/d/y");?></td>
          <td style="width:570px; text-align:left; padding-left:10px;">
                <a href="#">Apples</a>
          </td>
          <td style="text-align:center; padding-bottom:120px;">1</td>
          <td style="width:150px; padding-bottom:120px; text-align:center;">$59.99</td>
        </tr>
    </table>
    <div style="float:left; width:350px; font-size:12px; padding:10px;">*An order confirmation e-mail will be sent out to the address provided upon payment authorization.</div>
    <table id="registration-table2"> 
        <tr>
            <td style="font-weight:bold; width:140px; padding:10px; padding-right:20px;">Promo Code:</td>
            <td class="table2-cell">
                <form method="get" action="registernewstep2.php">
                    <input name="promo" style="width:90px; margin-right:7px; margin:5px;" type="text" /><br/>
                    <input type="submit" style="margin-bottom:5px;" value="update"/>
                </form>
            </td>
        </tr>
        <tr>
          <td class="table2-heading-cell">Delivery:</td>
          <td class="table2-cell"><i>Electronic</i></td>
        </tr>
        <tr>
          <td class="table2-heading-cell">Shipping:</td>
          <td class="table2-cell">$0.00</td>
        </tr>
        <tr>
          <td class="table2-heading-cell">Tax:</td>
          <td class="table2-cell">$0.00</td>
        </tr>
        <tr>
          <td class="table2-heading-cell">Total:</td>
          <td class="table2-cell">$59.99</td>
        </tr>
        <tr>
          <td style="font-weight:bold; padding:10px; border:none;"></td>
          <td style="text-align:center; border:none; padding-top:20px;">
            <!--CHECKOUT BUTTON-->
            <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
                <input type="hidden" name="cmd" value="_xclick">
                <input type="hidden" name="business" value="johnnycage9@gmail.com">
                <input type="hidden" name="lc" value="US">
                <input type="hidden" name="item_name" value="apples">
                <input type="hidden" name="item_number" value="1701">
                <input type="hidden" name="amount" value="1.00">
                <input type="hidden" name="currency_code" value="USD">
                <input type="hidden" name="button_subtype" value="services">
                <input type="hidden" name="no_note" value="0">
                <input type="hidden" name="tax_rate" value="0.000">
                <input type="hidden" name="shipping" value="0.00">
                <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_SM.gif:NonHostedGuest">
                <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!">
                <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
            </form>
          </td>
        </tr>
    </table>
</div>

<?php include('inc/footer.inc.php'); 

echo'
</div>
</body>
</html>';
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:16:30+00:00Added an answer on June 7, 2026 at 6:16 am

    The $_POST variables are only “posted” to the page that is displayed, so when your user enters and submits the promo code, you’re not currently posting the values that you’re missing.

    To do that, you’ll need to add some hidden fields to the form that is being submitted. The form field names have to be the same as the $_POST variable, and the value of each field should be the value from the posted field like this:

    <form method="get" action="registernewstep2.php">
        <input type="hidden" name="email" value="<?php echo $_POST['email'>; ?>"/>
        <input type="hidden" name="password" value="<?php echo $_POST['password'>; ?>"/>
        <input type="hidden" name="city" value="<?php echo $_POST['city'>; ?>"/>
        <input type="hidden" name="state" value="<?php echo $_POST['state'>; ?>"/>
        <input type="hidden" name="phone" value="<?php echo $_POST['phone'>; ?>"/>
        <input type="hidden" name="fname" value="<?php echo $_POST['fname'>; ?>"/>
        <input type="hidden" name="flname" value="<?php echo $_POST['flname'>; ?>"/>
        <input type="hidden" name="compname" value="<?php echo $_POST['compname'>; ?>"/>
        <input name="promo" style="width:90px; margin-right:7px; margin:5px;" type="text" /><br/>
        <input type="submit" style="margin-bottom:5px;" value="update"/>
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below works great except the email has all the text on one
I'm learning Java on my own; and therefore the code below has no function
Why does the code below result in org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed? The
I suppose button should has Close title in the code below, but it has
UPDATE 2011.09.13 This bug has been resolved by Adobe. The example code below now
I've got a simple question but it has got me confounded. The code below
This has been bothering me lately- when I use some code like below to
I have a chart (code to replicate will be below) that has two lines
Below I present you some code which has completely been butchered by me. $(.gig).hover(function()
I am currently exporting data from php to excel using the code as below:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.