Hey,
I have an issue when I fill out my form my e-mails are not being sent - it just goes back to a blank quote form. Why?
Another thing that I would like to do is instead of having:
PHP Code:
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
How could I make it so I could echo $Message from within the Site when it gets sent back to Quote.php?
My Code:
PHP Code:
<?php include('includes/header.php');
include('includes/class/class.form.php');
include('includes/class/class.phpmailer.php');
$formQuote = new Form('Quote.php', 'Quote','return CheckQuote();');
$formQuote->stickydata = $aStickyData;
if(isset($_POST["submit"])){
$formQuote->stickyData = $_POST;
$formQuote->checkNotEmpty("Name");
$formQuote->checkNotEmpty("Email");
$formQuote->checkNotEmpty("Message");
if($formQuote->getValid() == true){
$mail = new PHPMailer();
$body = $_POST['Message'];
$senderName = $_POST['Name'];
$senderEmail = $_POST['Email'];
$mail->SetFrom($senderEmail, $senderName);
$mail->AddReplyTo($senderEmail, $senderName);
$mail->AddAddress("Email","Name"); //TO
$mail->Subject = "Quote Request From Website";
$mail->MsgHTML($body);
if(!$mail->Send()){
$Message = "Mail Error: " .$mail->ErrorInfo;
}else{
$Message = "Thank You '".$senderName."' Your Quote Request Has Been Sent";
}
header('Location: index.php');
exit;
}
}
$aCouncil = array();
$aCouncil["0"] = "Please Select";
$aCouncil["1"] = "Yes";
$aCouncil["2"] = "No";
$aCouncil["3"] = "Pending";
$aCall = array();
$aCall["0"] = "Please Select";
$aCall["1"] = "(9am - 5pm)";
$aCall["2"] = "(6pm - 9pm)";
$formQuote->openFieldset();
$formQuote->makeInputBox("Name","Name","CheckInput(this.id);");
$formQuote->makeInputBox("Phone","Phone","CheckPhone(this.id);");
$formQuote->makeInputBox("Email ","Email","CheckEmail(this.id);");
$formQuote->makeDropDownList("Council Approval?","Council", $aCouncil);
$formQuote->makeDropDownList("Call Time","Call", $aCall);
$formQuote->makeTextArea("Project Description", "Message", "30","10", "CheckInput(this.id);");
$formQuote->makeSubmitButton("submit","Send Your Quote");
$formQuote->closeFieldset();
$newNavigation = new Navigation();
?>
<?php echo $newNavigation->mainMenu();?>
<h1 class="Heading">Quote Request</h1>
<p class ="Error"><?php echo $Message ?></p>
<?php echo $formQuote->getHTML(); ?>
<?php include('includes/footer.php')?>
Bookmarks