Solved

Existing PHP form to send Thank You email

Posted on 2009-05-19
7
332 Views
Last Modified: 2012-08-14
Below is our existing PHP form which is emailed to our staff. I also, would like to send a confirmation email to the person submitting this form. I would like to grab the Email Field and send a short confirmation email to him/her.

I do not know much about PHP, so if anyone who can make the necessary changes to the form below, I would really appreciate it.

Thanks.
<?
 

$JobDate = strtotime($_POST['JobDate']);

$newdate = strtotime("+3 day");

if($JobDate < $newdate)

{ session_start();

  $_SESSION['error'] = "We cannot accept web requests within 3 days of the job date. <br>Please call (800) 555-5555 to schedule this job!";

  header('Location: http://domain.com/client/schedule.php');

  exit;

}
 
 
 

// Post value declarations
 
 
 

$RqstType = $_POST["RqstType"];
 

$JobDate = $_POST["JobDate"];
 

$TimeZone = $_POST["TimeZone"];
 

$StartTime = $_POST["StartTime"];
 

$EndTime = $_POST["EndTime"];
 

$ScheduledDate = $_POST["ScheduledDate"];
 

$OrderedByFirstName = $_POST["OrderedByFirstName"];
 

$OrderedByLastName = $_POST["OrderedByLastName"];
 

$ContactFirstName = $_POST["ContactFirstName"];
 

$ContactLastName = $_POST["ContactLastName"];
 

$ContactMobile = $_POST["ContactMobile"];
 

$ContactPhone = $_POST["ContactPhone"];
 

$ContactFax = $_POST["ContactFax"];
 

$ContactEmail = $_POST["ContactEmail"];
 

$FirmName = $_POST["FirmName"];
 

$LocName = $_POST["LocName"];
 

$LocAddress = $_POST["LocAddress"];
 

$LocCity = $_POST["LocCity"];
 

$LocState = $_POST["LocState"];
 

$LocPostCode = $_POST["LocPostCode"];
 

$LocPhone = $_POST["LocPhone"];
 

$Witness1 = $_POST["Witness1"];
 

$Witness2 = $_POST["Witness2"];
 

$Witness3 = $_POST["Witness3"];
 

$ExpertType = $_POST["ExpertType"];
 

$CaseName = $_POST["CaseName"];
 

$CauseNo = $_POST["CauseNo"];
 

$Video = $_POST["Video"];
 

$Interpreter = $_POST["Interpreter"];
 

$GreenCopy = $_POST["GreenCopy"];
 

$Language = $_POST["Language"];
 

$RealTime = $_POST["RealTime"];
 

$Expedite = $_POST["Expedite"];
 

$TrialDate = $_POST["TrialDate"];
 

$domainWeb = $_POST["domainWeb"];
 
 

// 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: RBweb@domain.com <domain Support>' . "\r\n"; // This isn't working (ever) could be host anti-spam thing.
 

// $headers .= 'Cc:' . $EMail . "\r\n"; // Copy to ordering person (removed per request on 7/29/08)
 

$headers .= 'Bcc: pavelz@domain.com' . "\r\n"; // Copy to me as test
 
 
 

// Create repository order email
 
 
 

$to  = 'rinam@domain.com' . ', '; // note the comma
 

$to  .= 'elenab@domain.com' . ', ';
 

$to  .= 'saquibr@domain.com' . ', ';
 

$to  .= 'nicoleh@domain.com' . ', ';
 

$to  .= 'yavonk@domain.com' . ', ';
 

$to  .= 'jennifers@domain.com';
 
 
 

$subject = "Schedule a Deposition";
 
 
 

$message= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
 

<html xmlns=\"http://www.w3.org/1999/xhtml\">
 

<head>
 

<title>Schedule a Deposition</title>
 

<style type=\"text/css\">font.n{ color:#ffffff; font-size:13px; font-family:arial, helvetica; text-decoration:none;}
 

font.a{ color:006699; font-size:15px; font-family:arial, helvetica;}
 

font.ax{ color:ffffff; font-size:12px; font-family:arial, helvetica; text-decoration: none;}
 

font.b{ color:#000000; font-size:14px; font-family:arial, helvetica; text-decoration:none;}
 

font.bx{ color:#000000; font-size:13px; font-family:arial, helvetica; text-decoration:none; background: white}
 

font.c{ color:#9999cc; font-size:21px; font-family:arial, helvetica;}
 

font.d{ color:#000000; font-size:16px; font-family:arial, helvetica;}
 

font.e{ color:#000000; font-size:12px; font-family:arial, helvetica;}
 

font.f{
 

        color: Red;
 

        font-size: 12px;
 

        font-family:arial, helvetica;
 

        text-decoration:none;
 

        font-style : italic;
 

}
 

BODY, DIV, TD, LAYER { font-size:8.5pt; font-family:arial; font-color:white;}
 

A:link { color:blue; text-decoration:none; }
 

A:visited { color:blue; text-decoration:none; }
 

A:hover, { color:red; text-decoration:none; }
 

A:active { color:red; text-decoration:none; }
 

.style2 {font-size: 14}
 

.style4 {font-family: Arial, Helvetica, sans-serif}
 

.style5 {font-family: Arial, Helvetica, sans-serif; font-size: 14;}
 

.style6 {font-size: 10px}
 

.style7 {font-size: 12px}
 

.style8 {font-size: 14px}</style>
 

<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
 

</head>
 
 
 

<body>
 
 
 

<table width=\"550\" border=\"0\" cellpadding=\"5\" cellspacing=\"5\" bgcolor=\"#9999CC\">
 

  <tr>
 

    <td colspan=\"2\" scope=\"row\"><b>Depo Scheduled</b></td>
 

  </tr>
 

  <tr>
 

    <td align=\"left\" scope=\"row\" bgcolor=\"#9999CC\" width=\"25%\">Request Type: </td>
 

    <td width=\"75%\" bgcolor=\"#FFFFFF\">$RqstType</td>
 

  </tr>
 

  <tr>
 

    <td align=\"left\" scope=\"row\" bgcolor=\"#9999CC\">Job Date: <br /></td>
 

    <td bgcolor=\"#FFFFFF\">$JobDate</td>
 

  </tr>
 

  <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Time Zone: </td>
 

    <td bgcolor=\"#FFFFFF\">$TimeZone</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Start Time: </td>
 

    <td bgcolor=\"#FFFFFF\">$StartTime</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">End Time: </td>
 

    <td bgcolor=\"#FFFFFF\">$EndTime</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Date & Time Scheduled (Mountain Standard Time): </td>
 

    <td bgcolor=\"#FFFFFF\">$ScheduledDate</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Ordered By First Name: </td>
 

    <td bgcolor=\"#FFFFFF\">$OrderedByFirstName</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Ordered By Last Name: </td>
 

    <td bgcolor=\"#FFFFFF\">$OrderedByLastName</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Attorney First Name: </td>
 

    <td bgcolor=\"#FFFFFF\">$ContactFirstName</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Attorney Last Name: </td>
 

    <td bgcolor=\"#FFFFFF\">$ContactLastName</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Phone: </td>
 

    <td bgcolor=\"#FFFFFF\">$ContactPhone</td>
 

  </tr>
 

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Mobile: </td>
 

    <td bgcolor=\"#FFFFFF\">$ContactMobile</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Fax: </td>
 

    <td bgcolor=\"#FFFFFF\">$ContactFax</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Email: </td>
 

    <td bgcolor=\"#FFFFFF\">$ContactEmail</td>
 

  </tr>
 

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Firm Name: </td>
 

    <td bgcolor=\"#FFFFFF\">$FirmName</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Location Name: </td>
 

    <td bgcolor=\"#FFFFFF\">$LocName</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Location Address: </td>
 

    <td bgcolor=\"#FFFFFF\">$LocAddress</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Location City: </td>
 

    <td bgcolor=\"#FFFFFF\">$LocCity</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Location State: </td>
 

    <td bgcolor=\"#FFFFFF\">$LocState</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Location Zip: </td>
 

    <td bgcolor=\"#FFFFFF\">$LocPostCode</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Location Phone: </td>
 

    <td bgcolor=\"#FFFFFF\">$LocPhone</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Deponent1: </td>
 

    <td bgcolor=\"#FFFFFF\">$Witness1</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Deponent2: </td>
 

    <td bgcolor=\"#FFFFFF\">$Witness2</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Deponent3: </td>
 

    <td bgcolor=\"#FFFFFF\">$Witness3</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Expert Type: </td>
 

    <td bgcolor=\"#FFFFFF\">$ExpertType</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Case Name: </td>
 

    <td bgcolor=\"#FFFFFF\">$CaseName</td>
 

  </tr>

  

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Case Number: </td>
 

    <td bgcolor=\"#FFFFFF\">$CauseNo</td>

    

   </tr>

   

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Video: </td>
 

    <td bgcolor=\"#FFFFFF\">$Video</td>

    

      </tr>
 

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Interpreter: </td>
 

    <td bgcolor=\"#FFFFFF\">$Interpreter</td>

    

      </tr>

      

     <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Interpreter Language: </td>
 

    <td bgcolor=\"#FFFFFF\">$Language</td>
 

      </tr>

      

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">GreenCopy: </td>
 

    <td bgcolor=\"#FFFFFF\">$GreenCopy</td>
 

      </tr>

    

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">RealTime: </td>
 

    <td bgcolor=\"#FFFFFF\">$RealTime</td>

    

      </tr>
 

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Expedite: </td>
 

    <td bgcolor=\"#FFFFFF\">$Expedite</td>

    

      </tr>

    

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Trial Date: </td>
 

    <td bgcolor=\"#FFFFFF\">$TrialDate</td>
 

      </tr>

      

    <tr>
 

    <td align=\"left\"  scope=\"row\" bgcolor=\"#9999CC\">Sign up for domainWeb? </td>
 

    <td bgcolor=\"#FFFFFF\">$domainWeb</td>
 

      </tr>
 
 

</table>
 

</body>
 

</html>";
 
 
 

// Mail Repository order using values from above
 
 
 

mail($to, $subject, $message, $headers);
 
 
 

// Create confirmation page
 
 
 

     $landing_page = "client/schedule_thankyou.html";

           if ($landing_page != ""){

        header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");

    } else {

        header("Location: http://".$_SERVER["HTTP_HOST"]."/");

    }
 
 

?>

Open in new window

0
Comment
Question by:pzozulka
  • 4
  • 3
7 Comments
 
LVL 1

Expert Comment

by:trrsrr
ID: 24427411
If you want to send the same confirmation email to user that is also sent to admin then find for this line in the codes:

// $headers .= 'Cc:' . $EMail . "\r\n"; // Copy to ordering person (removed per request on 7/29/08)

unComment it and chage to

// $headers .= 'Cc:' . $ContactEmail . "\r\n";

as the value for $EMail is no longer available on the codes.
0
 
LVL 1

Expert Comment

by:trrsrr
ID: 24427415
Sorry .. forgot to unComment it .. OR remove the '//' sign at the beginning;

So .. it goes :

$headers .= 'Cc:' . $ContactEmail . "\r\n";
0
 
LVL 8

Author Comment

by:pzozulka
ID: 24427540
Actually I need to send a separate confirmation email to the user. Something as simple as "Thank you, we have received your request."
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Accepted Solution

by:
trrsrr earned 500 total points
ID: 24427632
Ok ... try to find these codes at the bottom of your codes:

-------------------------------------------------------------------
// Create confirmation page

     $landing_page = "client/schedule_thankyou.html";
           if ($landing_page != ""){
        header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
    } else {
        header("Location: http://".$_SERVER["HTTP_HOST"]."/");
    }
-------------------------------------------------------------------

and replace it with :
// Create confirmation page

 

$toUser		  = $ContactEmail;

$subjectUser  = 'Your Request Confirmation';							 // Your eMail subject to user

$messageUser  = 'Thank you, we have received your request.';			 // Your eMail message to user

$headersUser  = 'MIME-Version: 1.0' . "\r\n";

$headersUser .= 'content-type: text/plain; charset=iso-8859-1' . "\r\n"; // Sending plain text email to User

$headersUser .= 'From: RBweb@domain.com <domain Support>' . "\r\n";		 // Write Email Sender here

$headersUser .= 'Cc: ' . "\r\n";										 // Remove Cc

$headersUser .= 'Bcc: ' . "\r\n";										 // Remove Bcc

 

     $landing_page = "client/schedule_thankyou.html";

           if ($landing_page != ""){ 

		  mail($toUser, $subjectUser, $messageUser, $headersUser);

        header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");

    } else {

        header("Location: http://".$_SERVER["HTTP_HOST"]."/");

    }

Open in new window

0
 
LVL 8

Author Comment

by:pzozulka
ID: 24427656
Thanks looks very promising. I will try it out tomorrow morning.

Cheers
0
 
LVL 8

Author Comment

by:pzozulka
ID: 24433463
The Confirmation emails are coming to the user now, however, the form itself is also going to the user now. To clarify, the user is getting 2 emails. 1st - the confirmation email. 2nd - the email going to:

$to  = 'rinam@domain.com' . ', '; // note the comma
$to  .= 'elenab@domain.com' . ', ';
$to  .= 'saquibr@domain.com' . ', ';
$to  .= 'nicoleh@domain.com' . ', ';
$to  .= 'yavonk@domain.com' . ', ';
$to  .= 'jennifers@domain.com';
0
 
LVL 8

Author Comment

by:pzozulka
ID: 24433947
Nevermind, it works great. Thank you for your help.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now