Jump to content


Photo

Order Form


  • Please log in to reply
5 replies to this topic

#1 Slodge

Slodge
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 02 September 2006 - 09:22 PM

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.

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 September 2006 - 09:27 PM

#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
Legend has it that reading the manual never killed anyone.
My site

#3 Slodge

Slodge
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 02 September 2006 - 09:36 PM

I dont now much about php, can u give me some idea, hint or an example code ....

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 September 2006 - 09:48 PM

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)
Legend has it that reading the manual never killed anyone.
My site

#5 Slodge

Slodge
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 02 September 2006 - 10:05 PM

Here is the first form

<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>


And the Second

<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>



#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 September 2006 - 10:55 PM

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).

<form name="form1" method="post" action="my_second_form.php">

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:

<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

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

<?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.

?>


Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users