Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Mail Confirmation

the mail() function

Moderators: macek, egami, gesf

Mail Confirmation

Postby smcconnell » Mon May 19, 2014 5:33 pm

Hello –
I'm working on a form to email which I've done before but now need for it to send a confirmation to the person filling out the form, which I've never done before. I have read up and from what I can tell I need to add $headers2, $subject2, $autoreply, etc.. I found the following php form at Github but I don't know enough to make it work with what I have — I can't tell where to insert my own email address to get it to come to me, for starters: https://github.com/Goatella/PHPFormToEm ... f0f102f9e2

Here's my script so far (I scrapped my attempts to merge the Github with it):
<?php

/* NAME ADDRESS EMAIL PHONE etc... */

$emailSubject = 'My Subject';
$webMaster = 'me@verizon.net';


/* GATHERING DATA VARIABLES */


$show = "<font style=\"color:red;\">".$_POST['show']."</font>";
$company = "<font style=\"color:red;\">".$_POST['company']."</font>";
$email = $_POST['email'];
$phone = "<font style=\"color:red;\">".$_POST['phone']."</font>";
$address = "<font style=\"color:red;\">".$_POST['address']."</font>";
$city = "<font style=\"color:red;\">".$_POST['city']."</font>";
$state = "<font style=\"color:red;\">".$_POST['state']."</font>";
$zip = "<font style=\"color:red;\">".$_POST['zip']."</font>";
$tax = "<font style=\"color:red;\">".$_POST['tax']."</font>";
$buyer1 = "<font style=\"color:red;\">".$_POST['buyer1']."</font>";
$buyer2 = "<font style=\"color:red;\">".$_POST['buyer2']."</font>";
$buyer3 = "<font style=\"color:red;\">".$_POST['buyer3']."</font>";
$buyer4 = "<font style=\"color:red;\">".$_POST['buyer4']."</font>";
$confirmed = "<font style=\"color:red;\">".$_POST['confirmed']."</font>";

$body = <<<EOD
<hr><br>
Show(s) I Will Attend: $show <br>
<hr><br>
Company Name: $company <br>
Email: $email <br>
Phone: $phone <br>
Address: $address <br>
City: $city <br>
State: $state <br>
Zip Code: $zip <br><br>
<hr><br>

Tax ID: $tax <br>
Buyer Name: $buyer1 <br>
Buyer two Name: $buyer2 <br>
Buyer three: $buyer3 <br>
Buyer four: $buyer4 <br>
Have I Read the Requirements: $confirmed <br>
<hr><br>

EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/* RESULTS RENDERED AS HTML */

$theResults = <<<EOD
<!DOCTYPE HTML>
<html lang="en-US">
<head></head>
<body>

</body>
</html>
EOD;
echo "$theResults";

?>
smcconnell
New php-forum User
New php-forum User
 
Posts: 11
Joined: Mon Mar 28, 2011 1:59 pm

Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron