PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hey guys my form validates well but when everything in the form is filled out it wont send it just reloads the form with my info still in it and i cant seem to figure out why im sure its simple.
the target is #quote(using jquery for page) i just changed my code and it still does the same thing it wont let me do anything until all fields are filled in but then just reloads the form with my values still there and wont send
if ($_POST["Email, phone, name, details"]<>'') {
$ToEmail .= 'brendan@designpilotonline.com';
$EmailSubject .= 'Quote Form';
$mailheader .= "From: ".$_POST["name"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["Email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY .= "Name/Company: ".$_POST["name"]."<br />";
$MESSAGE_BODY .= "Email: ".$_POST["Email"]."<br />";
$MESSAGE_BODY .= "Phone: ".$_POST["phone"]."<br />";
$MESSAGE_BODY .= "Time: ".$_POST["call_option"]."<br />";
$MESSAGE_BODY .= "Development for: ".$_POST["development_for"]."<br /><br />";
$MESSAGE_BODY .= "Project Details:<br /><br /> ".nl2br($_POST["details"])."<br />";
if ($name != '' || $Email != '' || $phone != '' || $details != '' ){
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader);
echo '<div id="formmessage">
<p>Thank you for your submission. We are now thinking of the best possible solution for your project and will be back to you in the next 1 to 2 working days. If this is urgent contact info@designpilotonline.com or call us at 1 416 538 3003.
-Design Pilot</p>
</div>';
}
else {
echo 'Could Not send RFP ';
}
}
thanks that worked it now validates everything good and sends me the form but after i click submit the message comes up saying the form was sent and i recieve it to my email but the form it self is still sitting there underneath the thank you message im not sure why it doesnt go away
if ($_POST['Email'] != "" && $_POST['phone'] != "" && $_POST['name'] != "" && $_POST['details'] != "") {
$ToEmail .= 'brendan@designpilotonline.com';
$EmailSubject .= 'Quote Form';
$mailheader .= "From: ".$_POST["name"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["Email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY .= "Name/Company: ".$_POST["name"]."<br />";
$MESSAGE_BODY .= "Email: ".$_POST["Email"]."<br />";
$MESSAGE_BODY .= "Phone: ".$_POST["phone"]."<br />";
$MESSAGE_BODY .= "Time: ".$_POST["call_option"]."<br />";
$MESSAGE_BODY .= "Development for: ".$_POST["development_for"]."<br /><br />";
$MESSAGE_BODY .= "Project Details:<br /><br /> ".nl2br($_POST["details"])."<br />";
if ($_POST['Email'] != "" && $_POST['phone'] != "" && $_POST['name'] != "" && $_POST['details'] != ""){
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader);
echo '<div id="formmessage">
<p>Thank you for your submission. We are now thinking of the best possible solution for your project and will be back to you in the next 1 to 2 working days. If this is urgent contact info@designpilotonline.com or call us at 1 416 538 3003.
-Design Pilot</p>
</div>';
}
else {
echo 'Could Not send RFP ';
}
}
hard to say because you only post a part of your code, but my guess is that because it's all in the same file, it executes this bit of code, and after that, renders your form.
you would have to wrap your form within the "}else{" clause for it not to display.
the logic would then be:
if (all fields filled out){
send the email and <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>;
}else{
booboo message;
display form;
}
THANK YOU it works now just how i want it too thank you soo much for your help, yea i didnt post all my code because its like 10 pages in one using jquery so the code is extremely long.