Josh
Josh

Reputation: 3

PHP - How pass user input date from one form (page) to another filling in the same info for the user to verify

I'm trying to create an order form that will pass data from it to the same form but on a different page so the user can verify their information first then they will submit the data again for emailing and be redirected to a thank you page.

The problem is I haven't been able to get the info to pass into the form (same form different page). I also have to set up a conditional when the email(s) is sent because it needs to be sent to different people depending on which parts of the form are filled out.

Any help is greatly appreciated! I have a pretty good grasp of PHP, but it's been a long time since I've used it and this has been frustrating after spending a few days online searching for an answer. I'm sure this is something easy and I'll say, "Of course".

Thank you!

https://secure.kellypromotions.com/hmcpromo/order_form.php

https://secure.kellypromotions.com/hmcpromo/verify_order_roller.php

<form id="promo_order_form" name="promo_order_form" method="post" action="verify_order_form.php">

    <div id="order_form">
        <span id="sprytextfield7">
            <label for="Order_Date">Order Date:</label>
            <input type="text" name="Order_Date" id="Order_Date" />
            <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
        <br />
        <br />
        <span id="sprytextfield17">
            <label for="Date_Needed">Date Needed:</label>
            <input type="text" name="Date_Needed" id="Date_Needed" />
            <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
        <br />
        <br />
        <span id="sprytextfield16">
            <label for="AU">AU #:</label>
            <input type="text" name="AU" id="AU" />
            <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
        <br />
        (Required for ALL orders, including credit card orders)
        <br />
        <br />
        <span id="sprytextfield15">
            <label for="Approved">Approved by:</label>
            <input type="text" name="Approved" id="Approved" />
            <span class="textfieldRequiredMsg">A value is required.</span></span>
        <br />
        (Managers approval required)
        <br />
        <br />
        <span id="sprytextfield5">
            <label for="mgrEmail">Manager Email:</label>
            <input type="text" name="mgrEmail" id="mgrEmail" />
            <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
        <br />
        <br />
        <span id="sprytextfield14">
            <label for="Contact">Contact:</label>
            <input type="text" name="Contact" id="Contact" />
            <span class="textfieldRequiredMsg">A value is required.</span></span>
        <br />
        <br />
        <span id="sprytextfield13">
            <label for="Email">Email:</label>
            <input type="text" name="Email" id="Email" />
            <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
        <br />
        <br />
        <span id="sprytextfield12">
            <label for="Phone1">Phone #:</label>
            <input type="text" name="Phone1" id="Phone1" />
            <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
        <br />
        <br />
        <span id="sprytextfield8">
            <label for="Fax">Fax #:</label>
            <input type="text" name="Fax" id="Fax" />
            <span class="textfieldRequiredMsg">A value is required.</span></span>
        <br />
        <br />
        <span id="sprytextfield9">
            <label for="MAC">MAC #:</label>
            <input type="text" name="MAC" id="MAC" />
            <span class="textfieldRequiredMsg">A value is required.</span></span>
        <br />
        <br />
        <span id="sprytextfield10">
            <label for="Ship">Ship to:</label>
            <input type="text" name="Ship" id="Ship" />
            <span class="textfieldRequiredMsg">A value is required.</span></span>
        <br />
        <br />
        <span id="sprytextfield11">
            <label for="Attention">Attention:</label>
            <input type="text" name="Attention" id="Attention" />
            <span class="textfieldRequiredMsg">A value is required.</span></span>
        <br />
        <br />
    </div>

    <div id="personal_form">
        <div id="personal_header">PERSONAL ORDERS ONLY:</div>

        <span id="spryradio1">
            <label>
                <input type="radio" name="Visa" value="radio" id="Visa" />
                Visa</label>
            <br />
            <label>
                <input type="radio" name="Mastercard" value="radio" id="Mastercard" />
                Mastercard</label>
            <br />
            <label>
                <input type="radio" name="Amex" value="radio" id="Amex" />
                Amex</label>
        </span>

        <span id="sprytextfield21">
            <label for="CardNum">Card Number:</label>
            <input type="text" name="CardNum" id="CardNum" />
        </span>
        <br />
        <br />

        <span id="sprytextfield18">
            <label for="exp">EXP:</label>
            <input name="exp" type="text" id="exp" value="MM/DD" size="10" maxlength="5" />
        </span>

        <span id="sprytextfield20">
            <label for="cvs">CVS #:</label>
            <input name="cvs" type="text" id="cvs" size="5" maxlength="3" />
        </span>
        <br />
        <br />
        <span id="sprytextfield19">
            <label for="auth">Name on Card:</label>
            <input name="auth" type="text" id="auth" size="40" />
        </span>
    </div>

    <div id="delivery">
        <p>Please allow 3 weeks for delivery.
            <br />
            <br />
            Orders will ship via UPS Ground. Individual product styles will ship separately.
        </p>
    </div>

    <br />
    <ul>
        <li class="clear">PERSONALIZATION INFORMATION</li>
    </ul>

    <div id="pers_form">
        <span id="sprytextfield3">
            <label for="First">First Name:</label>
            <input type="text" name="First" id="First" />
            <span class="textfieldRequiredMsg">A value is required.</span></span>

        <span id="sprytextfield2">
            <label for="Last">Last Name:</label>
            <input type="text" name="Last" id="Last" />
            <span class="textfieldRequiredMsg">A value is required.</span></span><br /><br />

        <span id="sprytextfield4">
            <label for="Phone2">Phone #:</label>
            <input type="text" name="Phone2" id="Phone2" />
        </span>

        <span id="sprytextfield1">
            <label for="Email2">Email:</label>
            <input type="text" name="Email2" id="Email2" />
        </span>
    </div>

    <div id="totals_header">
        TOTAL COST
    </div>

    <br />
    <ul>
        <li>ITEM</li>
    </ul>

    <div id="item_form">
        <h3>Executive Metal Grip Roller</h3>
        <input name="ItemNum" type="hidden" id="ItemNum" value="EMGR" />
        <br />
        <input name="ItemPrice" type="text" id="ItemPrice" value="$1.10 Each" size="12" readonly="readonly" />
        <br />
        <br />
        <span id="sprytextfield6">
            <label for="Qty">Qty (Minimum 300):</label>
            <input name="Qty" type="text" id="Qty" size="10" />
            <span class="textfieldRequiredMsg">A value is required.</span><span          class="textfieldInvalidFormatMsg">Invalid format.</span><span class="textfieldMinValueMsg">The entered value is less than the minimum required.</span>  </span><br />
        <br />
        <label for="Total">Total:</label>
        <input name="Total" type="text" id="Total" size="25" readonly="readonly" />
        <br />
        <hr />
        <input type="submit" name="Submit" id="Submit" value="Submit" />
        <br />
    </div>

    <div id="totals_form">
        <label for="Subtotal">Subtotal</label>
        <input name="Subtotal" type="text" id="Subtotal" size="15" readonly="readonly" />
        <br />
        <br />
        <label for="Sales_Tax">Sales Tax (MN only)</label>
        <input name="Sales_Tax" type="text" id="Sales_Tax" size="15" />
        <br />
        <br />
        <label for="P_H">Packaging and Handling</label>
        <input name="P_H" type="text" id="P_H" value="$3.75" size="15" readonly="readonly" />
        <br />
        <br />  
        <label for="Freight">Freight</label>
        <input name="Freight" type="text" id="Freight" size="15" readonly="readonly" />
        <br />
        <hr />
        <label for="Totals">Total</label>
        <input name="Totals" type="text" id="Totals" size="15" readonly="readonly" />
    </div>

    <div class="clear"><!--CLEAR--></div>

</form>


<?php

//Order Form Var
$Order_Date = strip_tags($_POST['Order_Date']);
$Date_Needed = strip_tags($_POST['Date_Needed']);
$AU = strip_tags($_POST['AU']);
$Approved = strip_tags($_POST['Approved']);
$mgrEmail = strip_tags($_POST['mgrEmail']);
$Contact = strip_tags($_POST['Contact']);
$Email = strip_tags($_POST['Email']);
$Phone1 = strip_tags($_POST['Phone1']);
$Fax = strip_tags($_POST['Fax']);
$MAC = strip_tags($_POST['MAC']);
$Ship = strip_tags($_POST['Ship']);
$Attention = strip_tags($_POST['Attention']);

//Personal Order Form Var
$Visa = strip_tags($_POST['Visa']);
$Mastercard = strip_tags($_POST['Mastercard']);
$Amex = strip_tags($_POST['Amex']);
$exp = strip_tags($_POST['exp']);
$cvs = strip_tags($_POST['cvs']);
$auth = strip_tags($_POST['auth']);

//Personalization Form Var
$First = strip_tags($_POST['First']);
$Last = strip_tags($_POST['Last']);
$Phone2 = strip_tags($_POST['Phone2']);
$Email2 = strip_tags($_POST['Email2']);

//Item Form Var and Math
$ItemNum = strip_tags($_POST['ItemNum']);
$ItemPrice = strip_tags($_POST['ItemPrice']);
$ItemNum = strip_tags($_POST['ItemNum']);
$Qty = strip_tags($_POST['Qty']);
$Total = strip_tags($_POST['Total']);

//Totals Form Math
$Subtotal = strip_tags($_POST['Subtotal']);
$Sales_Tax = strip_tags($_POST['Sales_Tax']);
$P_H = strip_tags($_POST['P_H']);
$Freight = strip_tags($_POST['Freight']);
$Totals = strip_tags($_POST['Totals']);

?>

Upvotes: 0

Views: 2034

Answers (2)

David Nguyen
David Nguyen

Reputation: 8528

Your form is already posting to the second form so you don't need session variables. You can retrieve the values using $_POST['input_name'] on the verify page, if you need to verify what fields are being posted to the page you can use print_r($_POST)

Upvotes: 1

Prasanth
Prasanth

Reputation: 577

session_start();

and then

$_SESSION['key1'] = $val1;
$_SESSION['key2'] = $val2;

Do that for all the data. And then access the stuff using $_SESSION['key']

Upvotes: 1

Related Questions