0

我创建了一个三步订单表格,我需要第三步的帮助。1. 表格由商家填写并点击“预览订单” 2. 商家查看他们的订单并点击“确认”(应该在“bizform.php”但我没有尝试过,因为我不知道如何去做。) 3. 点击“确认”,将“网页”或“bizform.php”中的数据发送给企业和我自己。

问题:有可能吗?如果是这样,你能指出我正确的方向吗?TYVM

我的表格:

    <div class="span4 diff">
    <h3>Business Information</h3>
    <br/>
    <form action="bizform.php" method="post">
    <label for="bizName" class="control-label">
    Business:</label>
    <input type="text" id="bizName" name="bizName" class="input-large">

    <label for="bizAddress" class="control-label">
    Business Address:</label>
    <input type="text" id="bizAddress" name="bizAddress" class="input-large">

    <label for="bizCity" class="control-label">
    City:</label>
    <input type="text" id="bizCity" name="bizCity" class="input-large">

    <label for="bizState" class="control-label">
    State:</label>
    <input type="text" id="bizState" name="bizState" class="input-large">

    <label for="bizZip" class="control-label">
    Zip code:</label>
    <input type="text" id="bizZip" name="bizZip" class="input-large">

    <label for="fullName" class="control-label">
    Full Name:</label>
    <input type="text" id="fullName" name="fullName" class="input-large">

    <label for="bizEmail" class="control-label">
    E-mail:</label>
    <input type="text" id="bizEmail" name="bizEmail" class="input-large">
    </div>
    <div class="span7">
    <h3>Choose Products</h3>
    <br/>
    <table class="table table-bordered table-striped">
    <thead>
    <tr class="diffhead">
    <th>Product</th>
    <th>Price</th>
    <th>Training</th>
    <th>Total</th>
    <th>Qty</th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>Product One</td>
    <td>$1000.00</td>
    <td>$100.00</td>
    <td>$1100.00</td>
    <td>
    <label class="input" for="productOne"></label>
    <input type="text" class="input-mini" value="0" id="productOne" name="productOne">
    </td>
    </tr>
    <tr>
    <td>Product Two</td>
    <td>$1000.00</td>
    <td>$100.00</td>
    <td>$1100.00</td>
    <td>
    <label class="input" for="productTwo"></label>
    <input type="text" class="input-mini" value="0" id="productTwo" name="productTwo">
    </td>
    </tr>
    <tr>
    <td>Product Three</td>
    <td>$1000.00</td>
    <td>$100.00</td>
    <td>$1100.00</td>
    <td>
    <label class="input" for="productThree"></label>
    <input type="text" class="input-mini" value="0" id="productThree" name="productThree">
    </td>
    </tr>
    </tbody>
    </table>
    </div>
    </div>
    <div class="form-actions">
    <button class="btn btn-danger" type="reset" style="float:left">
    <i class="icon-remove-sign icon-white"></i> Cancel Order</button>
    <button class="btn btn-primary" type="submit" style="float:right">Preview Order 
    <i class="icon-circle-arrow-right icon-white"></i></button>
    </form>
    <?php
    include '_inc/footer.html';
    ?>

我的表单处理器:

        <?php
    include '_inc/header.html';
    ?>
    <?php 

    $bizName = $_POST['bizName'];
    $bizAddress = $_POST['bizAddress'];
    $bizCity = $_POST['bizCity'];
    $bizState = $_POST['bizState'];
    $bizZip = $_POST['bizZip'];
    $fullName = $_POST['fullName'];
    $bizEmail = $_POST['bizEmail'];

    $productOne = $_POST['productOne'];
    $productTwo = $_POST['productTwo'];
    $productThree = $_POST['productThree'];


    $moneyOff = '';

    $totalPro = $productOne + $productTwo + $productThree;

    define('PRODPRICE', 1100);

    $totalMoney = $productOne * PRODPRICE
    + $productTwo * PRODPRICE
    + $productThree * PRODPRICE;

    if ( $totalMoney == 2200 )
    {
    echo '<div class="alert alert-success">Go Back! You can get a product for free!</div>';
    }

    if ( $totalMoney == 3300 )
    {
    $moneyOff = 1100;
    }
    else
    {
    $moneyOff = 0;
    }


    define('STOCKFEE', 10);
    $stockFee = $productOne * STOCKFEE
    + $productTwo * STOCKFEE
    + $productThree * STOCKFEE;

    ?>
    <h1 align="center">Order Agreement</h1>
    <br/>
    <?php 
    echo '<strong>' .$bizName. '</strong> is purchasing the following products and services from CBE:</p>';
    echo '<div class="well">
    <table cellspacing="0" cellpadding="0" width="800px">
    <thead>
    <th>Qty</th>
    <th>Product</th>
    <th>Price</th>
    </thead>
    <tbody>
    <tr>
    <td align="center">'. $productOne .'</td>
    <td align="center">Product One</td>
    <td align="center">$1,100.00</td>
    </tr>
    <tr>
    <td align="center">'. $productTwo .'</td>
    <td align="center">Product Two</td>
    <td align="center">$1,100.00</td>
    </tr>
    <tr>
    <td align="center">'. $productThree .'</td>
    <td align="center">Product Three</td>
    <td align="center">$1,100.00</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td align="right">Sub Total:</td>
    <td align="center">'.number_format($totalMoney,2).'</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td align="right">Discount:</td>
    <td align="center">'.number_format($moneyOff,2).'</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td align="right">Grand Total:</td>
    <td align="center">'.number_format($totalMoney - $moneyOff,2).'</td>
    </tr>
    </tbody>
    </table>
    </div>';
    echo '<p>Business agrees to pay <strong> '.number_format($totalMoney - $moneyOff,2).' </strong>for these products and services. In addition, Business will pay an additional <strong> '.number_format($stockFee,2).' </strong>to cover stock fee.</p>';
    ?>
    <div class="row">&nbsp;</div>
    <div class="row">
    <div align="left">
    <table cellspacing="10" cellpadding="10" width="850px">
    <tbody>
    <tr><td>&nbsp;</td></tr>
    <tr>
    <td valign="top">
    <?php 
    echo '<strong>' .$bizName. '</strong> <br/>';
    echo $bizAddress.'<br/>';
    echo $bizCity.', ';
    echo $bizState.' ';
    echo $bizZip.'';
    ?>
    </td>
    <td valign="top">
    <strong>CBE</strong><br/>
    Corporate Headquarters<br/>
    555 Main Street<br/>
    PHPLAND, DB 78987-3849<br/>
    888-098-3049
    </td>
    </tr>
    </tbody>
    </table>
    </div>
    </div>
    <?php
    include '_inc/footer.html';
    ?>
4

3 回答 3

0

当您将表单提交到 bizform.php 时,将您发布的变量存储在隐藏的输入字段中,然后在第 3 步将这些变量提交给您的表单处理器。

编辑:

换句话说,让您的确认流程将您的隐藏字段发布到另一个处理器,该处理器从 POST 创建您的电子邮件内容,然后发送给企业,并将您自己作为 CC 或 BCC 标头。

<input name="AID" type="hidden" id="AID" value="<?php echo $_POST['AID']; ?>" size="32" />
于 2012-06-18T19:54:25.277 回答
0

由于您可以通过 $_POST 数组轻松访问数据,因此要将所有这些信息发送给相应的收件人,请使用mail()php 的功能来创建电子邮件并将其发送给您想要的任何人。

于 2012-06-18T19:55:49.003 回答
0

要跨多个表单存储数据:

<?php
  session_start(); // Initiates the session, and loads the _SESSION variable

  var_dump($_SESSION); // Show the data in the _SESSION variable

  // Load data into the sessions
  $_SESSION['a'] = 1;
  $_SESSION['b'] = 'hello world';

  if (!isset($_SESSION['c'])) $_SESSION['c'] = 0;
  else $_SESSION['c'] += 2;

首先,您应该看到一个空数组。然后,刷新,您将看到您的会话数据。

http://php.net/manual/en/features.sessions.php - 供参考和进修...

于 2012-06-18T19:58:33.313 回答