Hello Everyone,
Currently our form is not sending confirmation emails. We can see the quote requests in our content management system however are sales team is not getting the email requesting the quote. There is no option in our content management system to click this on or off so I am assuming something is not right in the code.
form-process.php
<?
session_start();
include('settings.php');
include('classes/class.formdata.php');
include('classes/class.email.php');
include('classes/class.DB.php');
include('functions/functions.general.php');
if ($_POST["PreviousOrderNumber"]){$_POST["Layout*"]=$_POST["PreviousOrderNumber"];}
unset($_POST["PreviousOrderNumber"]);
$newformdata = new FormData($_POST);
//echo "Hello";
switch ($send_form_data) {
case 'email': {
if (!$_SESSION['formerrors']) {
$newemail = new Email($to,$from, $subject);
$newemail->SendEmail();
var_dump($_SESSION["formdata"]);
unset($_SESSION["formdata"]);
$redirect = $newformdata->referrer;
header("Location: $redirect");
}
} break;
case 'email/db': {
if (!$_SESSION['formerrors']) {
$newemail = new Email($to,$from, $subject);
$newemail->SendEmail();
$dbFormData = new DB();
$dbFormData->writePostToDB($_SESSION["formdata"],"QuoteRequests");
if (count($_FILES)>1){
$dbFormData->writeFilesToDB($_FILES,"QuoteRequests");
}
unset($_SESSION["formdata"]);
}
} break;
default: {
echo 'Invalid setting in variable $send_form_data';
} break
;
}
//echo "END";
//exit;
$redirect = $newformdata->referrer;
header("Location: $redirect");
exit;
$newformdata = new FormData($_POST);
//var_dump($_SESSION['formerrors']) . " - " .var_dump($_SESSION["formdata"]);exit;
switch ($send_form_data) {
case 'email': {
if (!$_SESSION['formerrors']) {
$newemail = new Email($to,$from, $subject);
$newemail->SendEmail();
unset($_SESSION["formdata"]);
}
} break
;
default: {
echo 'Invalid setting in variable $send_form_data';
} break
;
}
//insert into db
if (!$_SESSION['formerrors']) {
$arg = '';
$FirstName= $_POST['FirstName*'];
$LastName= $_POST['LastName*'];
$Company= $_POST['Company'];
$Phone= $_POST['Phone*'];
$Fax= $_POST['Fax'];
$Email= $_POST['Email*'];
$PONumber= $_POST['PONumber'];
$Address= $_POST['Address*'];
$ApartmentOrUnitNumber= $_POST['ApartmentOrUnitNumber'];
$City= $_POST['City*'];
$State= $_POST['State*'];
$Zip= $_POST['Zip*'];
$Quantity= $_POST['Quantity*'];
$Height= $_POST['Height*'];
$Width= $_POST['Width*'];
$Characters= $_POST['Characters*'];
$AdditionalCharacters= $_POST['AdditionalCharacters'];
$Metal= $_POST['Metal*'];
$Border= $_POST['Border*'];
$Texture= $_POST['Texture*'];
$Color= $_POST['Color*'];
$Finish= $_POST['Finish*'];
$Mounting= $_POST['Mounting*'];
$Font= $_POST['Font*'];
$Capitalization= $_POST['Capitalization*'];
$Proof= $_POST['Proof*'];
$Layout= $_POST['Layout*'];
$Logo= $_POST['Logo'];
$SpecialInstructions= $_POST['SpecialInstructions'];
//echo "Done"; exit;
$arg = "INSERT INTO `healypla_general`.`QuoteRequests` (`Quote_Id`, `FirstName`, `LastName`, `Company`, `Phone`, `Fax`, `Email`, `PONumber`, `Address`, `ApartmentOrUnitNumber`, `City`, `State`, `Zip`, `Quantity`, `Height`, `Width`, `Characters`, `AdditionalCharacters`, `Metal`, `Border`, `Texture`, `Color`, `Finish`, `Mounting`, `Font`, `Capitalization`, `Proof`, `Layout`, `Logo`, `SpecialInstructions`, `DateSubmitted`)
VALUES (NULL, '$FirstName ', '$LastName', '$Company', '$Phone', '$Fax', '$Email', '$PONumber', '$Address', '$ApartmentOrUnitNumber', '$City', '$State', '$Zip', '$Quantity', '$Height', '$Width', '$Characters', '$AdditionalCharacters', '$Metal', '$Border', '$Texture', '$Color', '$Finish', '$Mounting', '$Font', '$Capitalization', '$Proof', '$Layout', '$Logo', '$SpecialInstructions', CURRENT_TIMESTAMP);";
$newdb = new DB($dbhost, $dbuser, $dbpass, $dbname);
$arg = $arg;
$result1 = $newdb->insert_db($arg);
}
$redirect = $newformdata->referrer;
if ($_SESSION['formerrors']) { header("Location: $redirect"); } else {
echo "Done";}
exit;
?>
$FirstName= $_POST['FirstName*'];
$LastName= $_POST['LastName*'];
$Company= $_POST['Company'];
$Phone= $_POST['Phone*'];
$Fax= $_POST['Fax'];
$Email= $_POST['Email*'];
$PONumber= $_POST['PONumber'];
$Address= $_POST['Address*'];
$City= $_POST['City*'];
$State= $_POST['State*'];
$Zip= $_POST['Zip*'];
$Quantity= $_POST['Quantity*'];
$Height= $_POST['Height*'];
$Width= $_POST['Width*'];
$Characters= $_POST['Characters*'];
$AdditionalCharacters= $_POST['AdditionalCharacters'];
$Metal= $_POST['Metal*'];
$Border= $_POST['Border*'];
$Texture= $_POST['Texture*'];
$Color= $_POST['Color*'];
$Finish= $_POST['Finish*'];
$Mounting= $_POST['Mounting*'];
$Font= $_POST['Font*'];
$Capitalization= $_POST['Capitalization*'];
$Proof= $_POST['Proof*'];
$Layout= $_POST['Layout*'];
$Logo= $_POST['Logo'];
$SpecialInstructions= $_POST['SpecialInstructions'];
then settings.php
<?
//Global settings
//Handles what to do with form data after it has been validated
//email or database
$send_form_data = 'email/db';
//Email settings
//Where to send email
$to = 'sales@healyplaques.com';
//Where it came from
$from = 'quote';
//Subject of email
$subject = 'Custom Plaque Quote - ';
//Database settings
?>
Any help would be extremely appreciated!
Thanks,
Amanda Smith