Jump to content

Archived

This topic is now archived and is closed to further replies.

Slodge

Order Form

Recommended Posts

Can u guys tell me how to do this.
1. An order form which which sent the order details to me using html  and the sent the same order details to the person filling up the order form

2. An order form having 2 pages. First page contains Order item, Order code and Payment type, and after filling the three , user have to click continue to fill up for his address and other things.

Share this post


Link to post
Share on other sites
#1 - see the manual page about the mail() function.

#2 - retrieve the data passed by the first form (if the form method is 'post', read the $_POST array variables) and enter them in hidden fields in the second form

Share this post


Link to post
Share on other sites
You first.  Show us the first form, show us the second form (preferably without too much of the html junk that's nothing to do with the real forms code)

Share this post


Link to post
Share on other sites
Here is the first form
[quote]
<form name="form1" method="post" action="">
  <table width="29%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="53%">Product Code</td>
      <td width="47%"><input name="productcode" type="text" id="productcode"></td>
    </tr>
    <tr>
      <td>Product Item</td>
      <td><input name="productitem" type="text" id="productitem"></td>
    </tr>
    <tr>
      <td>Payment Type</td>
      <td> <select name="select" size="1">
          <option value="Paypal" selected>Paypal</option>
          <option value="Money Order">Money Order</option>
          <option value="Demand Draft">Demand Draft</option>
        </select> </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input name="Next" type="button" id="Next" value="Next"></td>
    </tr>
  </table>
</form>
[/quote]

And the Second
[quote]<form name="form1" method="post" action="">
  <table width="29%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="53%" height="24">Name</td>
      <td width="47%"><input name="Name" type="text" id="Name"></td>
    </tr>
    <tr>
      <td>Address</td>
      <td><input name="Address" type="text" id="Address"></td>
    </tr>
    <tr>
      <td>City</td>
      <td><input name="City" type="text" id="City"> </td>
    </tr>
    <tr>
      <td>State</td>
      <td><input name="State" type="text" id="State"></td>
    </tr>
    <tr>
      <td>Pin</td>
      <td><input name="Pin" type="text" id="Pin"></td>
    </tr>
    <tr>
      <td>Phone</td>
      <td><input name="Phone" type="text" id="Phone"></td>
    </tr>
    <tr>
      <td>Email </td>
      <td><input name="Email" type="text" id="Email"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><input type="reset" name="Reset" value="Reset"></td>
      <td><input type="submit" name="Submit2" value="Submit"></td>
    </tr>
  </table>
</form>[/quote]

Share this post


Link to post
Share on other sites
Here's the low budget version of what comes next.  It should help:

Edit the first form so that the action point to the second form (and the second form will need to be named with a .php extension).

[code]<form name="form1" method="post" action="my_second_form.php">[/code]

Edit the second form (whose file name matches whatever you used in the first form's action=) so that the form part begins like this:

[code]<form name="form1" method="post" action="my_form_mail_script.php">
<?php
// retrieve data from the first form
$productcode = $_POST['productcode'];
$productitem = $_POST['productitem'];
$payment = $_POST['select'];

// now add those to hidden field for passing along further
echo "<input type='hidden' name='productcode' value='". $productcode. "'/>\n";
echo "<input type='hidden' name='productitem' value='". $productitem. "'/>\n";
echo "<input type='hidden' name='payment' value='". $payment. "'/>\n";
?>

... the rest of your second form goes here
[/code]

Now create a new script named my_form_mail_script.php that looks like this:

[code]<?php
$productcode = $_POST['productcode'];
$productitem = $_POST['productitem'];
$payment = $_POST['select'];
// do the same with the other fields in the second form

// now you have all the passed data so make it a 'message'

$msg = "Product code: ". $productcode. "\n";
$msg.= "Product item: ". $productitem. "\n";
// keep going building the message

// see the manual for how to send mail using the mail function.

?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.