Jump to content

forms related question


bigF

Recommended Posts

hi everyone...

 

what i am trying to do is that i have a form that a user will input data in and then press the submit button...when the submit button is pressed this form should be validated and modified according to the user input and fields will be deleted or added to this form and then finally mailed after being validated and modified....i have managed to work with phpMailer, but what i cant figure out how to do is email this form as an HTML mail which will be read by an administrator for example....

 

please help in pointing me in the right direction

 

thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/122444-forms-related-question/
Share on other sites

Here is an example of an html email that I created for a site that I did several years ago.  It may be a little sloppy but it works.

 

<?php 


$resdat=$_GET['resdate'];
$product=$_GET['product'];
$price=$_GET['price'];
$fname=$_GET['fname'];
$lname=$_GET['lname'];
$address=$_GET['address'];
$city=$_GET['city'];
$zip=$_GET['zip'];
$phone=$_GET['phone'];
$email=$_GET['email'];
$delivery=$_GET['delivery'];
$pickup=$_GET['pickup'];
$guests=$_GET['guests'];
$payment=$_GET['payment'];
$referal=$_GET['referal'];
$comments=$_GET['comments'];

if ($payment=="Credit Card (online)") {

$payment= ("<a href=\"https://www.somesite.com/payonline.htm\">Credit Card (click here to pay online)</a>");
}


$to="$email";

$subject="$product Reservation for $resdate";

$message = "<html>
<body>

<img src=\"http://www.somesite.com/Logo1.gif\">
<br>
Hello $fname, 
<p>Thank you for choosing my company for your product rental.<br>
Your reservation has been accepted and the $product has been reserved<br>
for you for the date of $resdate.  Please look over the following<br>
information and verify that it is correct:</p>
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<th align=\"right\" bgcolor=\"#CCCCCC\">Reservation Date:</th><th align=\"left\" bgcolor=\"#CCCCCC\">  $resdate</th><th align=\"right\"> Price: \$89.00</th>
</tr>
<tr>
<th align=\"right\">Product Name:</th><th align=\"left\">  $product</th><th align=\"right\"> Tax: <font size=\"2\">(8.25%)</font><u> + \$7.34</u></th> 
</tr>
<tr>
<th align=\"right\" bgcolor=\"#CCCCCC\">Customer Name:</th><th align=\"left\" bgcolor=\"#CCCCCC\">  $fname $lname</th><th align =\"right\"> <font color=\"red\"> Total: \$96.34</font></th>
</tr>
<tr>
<th align=\"right\">Delivery Address:</th><th align=\"left\">  $address</th>
</tr>
<tr>
<th align=\"right\" bgcolor=\"#CCCCCC\">City & Zip Code:</th><th align=\"left\" bgcolor=\"#CCCCCC\">  $city, TX  $zip</th>
</tr>
<tr>
<th align=\"right\">Phone Number:</th><th align=\"left\">  $phone</th>
</tr>
<tr>
<th align=\"right\" bgcolor=\"#CCCCCC\">Email Address:</th><th align=\"left\" bgcolor=\"#CCCCCC\">  $email</th>
</tr>
<tr>
<th align=\"right\">Delivery Time:</th><th align=\"left\">  $delivery</th>
</tr>
<tr>
<th align=\"right\" bgcolor=\"#CCCCCC\">Pick-up Time:</th><th align=\"left\" bgcolor=\"#CCCCCC\">  $pickup</th>
</tr>
<tr>
<th align=\"right\"> Guests Expected:</th><th align=\"left\">  $guests</th>
</tr>
<tr>
<th align=\"right\" bgcolor=\"#CCCCCC\">Method of Payment:</th><th align=\"left\" bgcolor=\"#CCCCCC\">  $payment</th>
</tr>
</table>

<p>
<b>*Please save this email for your records*</b>
</p>

<p>
If any of this information is incorrect please contact us as soon as possible<br>
so that we can update our records.  Your payment is due upon delivery of your<br>
$product.  Thank you again for allowing my company to provide you with your<br>
product rental.</p>
<p>
Joe Blow<br>
Some Company<br>
(123) 456-7890<br>
</p>
</body>
</html>";

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers

$headers .= 'From: My Company <[email protected]>' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

?>

Archived

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

×
×
  • Create New...

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.