• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

Existing PHP form to send Thank You email

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
pzozulka
Asked:
pzozulka
  • 4
  • 3
1 Solution
 
trrsrrCommented:
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
 
trrsrrCommented:
Sorry .. forgot to unComment it .. OR remove the '//' sign at the beginning;

So .. it goes :

$headers .= 'Cc:' . $ContactEmail . "\r\n";
0
 
pzozulkaAuthor Commented:
Actually I need to send a separate confirmation email to the user. Something as simple as "Thank you, we have received your request."
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
trrsrrCommented:
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
 
pzozulkaAuthor Commented:
Thanks looks very promising. I will try it out tomorrow morning.

Cheers
0
 
pzozulkaAuthor Commented:
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
 
pzozulkaAuthor Commented:
Nevermind, it works great. Thank you for your help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now