It WAS working ...

I created a form for potential customers to request a quote. It gathers info and uses sendmail (mail($headers, etc.) to gather the entered info and send it to our CM Manager.

The mail part works fine. But I can’t seem to get it to go to the thank you page (or back to the form page, if the mail function fails). The funny thing is, at one point it worked – I’m not sure why it’s not working now. There’s every chance it could be my host, but before ask for help there, I wanted to be sure I didn’t have some noob error in my code.

After the mail function is called, I use the following to try to redirect:

[php]<? php[/php]
if ($mailsend === TRUE) {
echo ‘’;
exit;
} else {
echo ‘’;
echo ‘’;
exit;
}
[php][/php]

I tried header(location()), etc. first, but got the ever-popular “Headers already sent …” message.

Also, the PHP is external to the shtml files (request_quote.shtml and thank_you.shtml) and I am using a full URL (http://www.bardonsoliver.com/newbnocm/thank_you.shtml, etc.) to point the way to the files.

If there’s anything else you need to know in order to help me, please let me know. I have all kinds of error checking turned on and I’m not getting any errors back – but I don’t know if I would, if the problem’s in the JS.

Thanks for any help.

Janet

It looks like you have a lot of comma’s that should be periods and a few misplaced “)”. Give the code below a shot.

[php] if ($mailsend === TRUE) {
echo ‘’;
exit;
} else {
echo ‘’;
echo ‘’;
exit;
}[/php]

I tried that – and thanks – but I still get left in the email_file.php screen … I’m going to post the whole script (it’s not too long) and maybe there’s something further up I’m missing:

[php]

<?php // Same as error_reporting(E_ALL); ini_set('error_reporting', E_ALL); switch (@$_GET['do']) { case "send": $name = $_POST['wholename']; $company = $_POST['company']; $femail = $_POST['femail']; $fphone1 = $_POST['fphone1']; $fsendmail = $_POST['fsendmail']; $qnb = $_POST['qnb']; $pnb = $_POST['pnb']; $retpage='http://www.bardonsoliver.com/newbnocm/request_quote.shtml'; $typage='http://www.bardonsoliver.com/newbnocm/thank_you.shtml'; $secretinfo = $_POST['info']; // test e-mail if (!filter_var($femail, FILTER_VALIDATE_EMAIL)) { unset($_GET['do']); printf(""); printf(""); break; } // test telephone if(strlen($fphone1) < 10) { unset($_GET['do']); printf(""); printf(""); break; } if ($secretinfo == "") { $myemail = "[email protected]"; $ccemail = "[email protected]"; $bccemail = "[email protected]"; $ehead = "From: ".$femail."\r\n"; $ehead .= "Reply-To: ".$myemail."\r\n"; $ehead .= "Cc: ".$ccemail."\r\n"; $ehead .= "Bcc: ".$bccemail."\r\n"; $emess = "Name: ".$name."\r\n"; $emess.= "Company: ".$company."\r\n"; $emess.= "Email: ".$femail."\r\n"; $emess.= "Phone number: ".$fphone1."\r\n"; $emess.= "Comments: ".$fsendmail."\r\n"; $emess.= "Quote Needed By: ".$qnb."\r\n"; $emess.= "Parts Needed By: ".$pnb."\r\n"; $subj = "Request for quote from ".$name; $emess = wordwrap($emess, 70, "\r\n"); $mailsend = mail("$myemail","$subj","$emess","$ehead"); } unset($_GET['do']); if ($mailsend === TRUE) { echo ''; break; } else { echo ''; echo ''; break; } } ?>

[/php]

The problem are the syntax. You write “+” to merge php code and yo must write “.”.
For example in line
printf(“");

Must be
printf(“");

if $retpage was a var in javascript the code can be
printf(“”);
but in this case the var is a php var $retpage

THANK you! If you were here I’d hug you, I swear! :slight_smile: … thanks for the lesson and the help.

Sponsor our Newsletter | Privacy Policy | Terms of Service