View Full Version : Wanting to send message to a specific department
I have uploaded a contact page using the Contact Form solution. I had to place the elements into different table cells to match other forms on the site. There are 3 different departments that need to be contacted. I want the subject to reflect the department it is going to. Right now I have the e-mail addresses going back to me to make sure they work right. Right now, as far as I can determine, it's sending nothing out. I tried to follow the email advice "Form sent to email address depending on option chosen" posted by info231367 on 04-05-10 given by Jason Byrnes. I can't figure how I screwed it up but I know I did. Help
Jason Byrnes
05-26-2010, 12:00 PM
the coding looks correct.
Does it redirect to the thank you page?
or just stay on the contact page?
it looks like the form elements for contact name and email address are not named the same as the original contact form.
The securty elements are also removed.
This is causing the validation to fail.
remove the following code block:
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WAFV_Redirect = "";
$_SESSION['WAVT_contact_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Contact_Name"]))?$_POST["Contact_Name"]:"") . "",true,1);
$WAFV_Errors .= WAValidateEM(((isset($_POST["Email_address"]))?$_POST["Email_address"]:"") . "",true,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Comments"]))?$_POST["Comments"]:"") . "",true,3);
$WAFV_Errors .= WAValidateLE(((isset($_POST["Security_code"]))?strtolower($_POST["Security_code"]):"") . "",((isset($_SESSION["captcha_1"]))?strtolower($_SESSION["captcha_1"]):"") . "",true,4);
$WAFV_Errors .= WAValidateLE(((isset($_POST["Security_question"]))?strtolower($_POST["Security_question"]):"") . "",((isset($_SESSION["random_answer"]))?strtolower($_SESSION["random_answer"]):"") . "",true,5);
$WAFV_Errors .= WAValidateRX(((isset($_POST["addblock"]))?$_POST["addblock"]:"") . "","/^$/i",false,6);
$WAFV_Errors .= WAValidateRX(((isset($_POST["seconddblock"]))?$_POST["seconddblock"]:"") . "","/^$/i",false,7);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"contact");
}
}
?>
this is validating form elements that doent exist in your form causing validation to fail.
That helped and I am getting the Thank you page to come up.
When you say "it looks like the form elements for contact name and email address are not named the same as the original contact form" I can't find the difference. Could you point me to it.
Also, when I receive the e-mail I get 2 each time. The first email is empty and the second shows the info below. It doesn't show what I have created for the message and it doesn't have the subject line I need it to have. The body is just the name of the binding.
Example below:
Contact Form Response
sendTo: mailAdmin@brosco-bartley.com
contactName: Boyd
contactCompany: Brosco-bartley
contactEmail: bbgd@sbcglobal.net
contactPhone: 817-2381-0884
contactPreference: Email
contactComments: Lorem ipsum d...
Is there anything else I need to get you to help?
Jason Byrnes
06-01-2010, 11:33 AM
the form element names used by the original contact form solution pack are:
Contact_Name
Email_address
Comments
you are using:
contactName
contactEmail
contactComments
Instead of using two separate recipient line:
$RecipientEmail = "".(isset($_POST['sendTo'])?$_POST['sendTo']:"") ."";include("WA_Universal_Email/WAUE_contact_1.php");
$RecipientEmail = "mailadmin@brosco-bartley.com";include("WA_Universal_Email/WAUE_contact_1.php");
you can combine them into one:
$RecipientEmail = "".(isset($_POST['sendTo'])?$_POST['sendTo']:"") .",mailadmin@brosco-bartley.com";include("WA_Universal_Email/WAUE_contact_1.php");
that message looks correct according to the WA_UniversalEmail/templates/contactus.php file that is being used to generate the email body.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.