简体   繁体   English

PHP - 如何将用户输入日期从一个表单(页面)传递到另一个填写相同信息以供用户验证

[英]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.非常感谢任何帮助,我对 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/order_form.php

https://secure.kellypromotions.com/hmcpromo/verify_order_roller.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']);

?>
session_start();

and then接着

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

Do that for all the data.对所有数据执行此操作。 And then access the stuff using $_SESSION['key']然后使用 $_SESSION['key'] 访问这些东西

Your form is already posting to the second form so you don't need session variables.您的表单已经发布到第二个表单,因此您不需要 session 变量。 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)您可以在验证页面上使用$_POST['input_name']检索值,如果您需要验证哪些字段正在发布到页面,您可以使用print_r($_POST)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我们可以使用同一页面中另一种形式的用户输入数据吗 - can we use user input data from one form in another form of same page 如何使用在另一个php页面的一个html页面中定义的用户输入从Oracle数据库中获取数据 - how to use a user input defined in one html page in another php page to fetch data from oracle database 如何将变量从一个php页面传递到另一个没有表单? - How to pass variables from one php page to another without form? 如何在一个页面中将变量从一个函数传递给另一个函数? - how to pass variable from one function to another in the same page in php? 如何将用户输入数据发送到PHP以及如何将数据从一个PHP页面发送到另一个PHP页面 - How would I send user input data to PHP & send data from one PHP page to another PHP page 如何将php变量从一个div传递到同一页面中的另一个div,而不是传递给另一页面? - How to pass php variable from one div to another div in the same page than pass to another page? 如何将变量从一页上的输入框传递到另一页上,并使用此信息在第2页上执行搜索? - how can I pass a variable from an input box on one page to another page and use this info to perform a search on page 2? 使用php在同一页面上发布带有用户输入的表单 - Posting the form with the user's input on the same page with php 如何将输入值从一个php页面传递到另一个php页面 - how to pass the input value from one php page to another php page 如何以php形式将输入值的一页传递到另一页? - how to pass input value one page to antother page in php form?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM