Jump to content

php script redirect while sending pdf as attachement


zamansoomro

Recommended Posts

I am new in php programming and I have develop php script using TCPDF libary that takes data from pdf form fields and create flatten copy of that PDF using TCPDF , after that I use "AttachMailer.php" to send copies of PDF to client and customer, when user fill pdf form and click submit button flatten copy of that pdf is created in wp-content/uploads/pdf folder , and email code gets same copy fro wp-content/uploads/pdf folder and copy is forwarded to client and customer once copies are forwarded, it should show message "email has been sent.....email-address".

// =============Email Form===============================
require_once(dirname(__FILE__)."/AttachMailer.php");
$mailer = new AttachMailer($Email, $Email, "Submitted Form Copy", "hello <b>Please Find the Attached Copy of form sumitted</b>");

$mailer->attachFile($fpath.$Contact_Name.'_'.$Email.$fID);

$mailer1 = new AttachMailer($Email,$CEmail, "CC for client Submitted Form ", "hello <b>Please Find the Attached Copy of form sumitted by </b>".$Contact_Name);

$mailer1->attachFile($fpath.$Contact_Name.'_'.$Email.$fID);

if($mailer->send()) {
echo "Email has been sent to ".$Email."\n and" ; }
else{
echo "error in email\n";
exit();
}
if($mailer1->send()){
echo "\nCC has been sent to ".$CEmail ;
}
else{echo "\nerror in email CC was not sent to ".$CEmail;}!

the problem is that when user click submit button he/or she is redirected to home page (which i dont want)with executing if and else statements in email code shown above

please help me how can I stop redirecting to home page.

you can see screenshot of redirected page from my dropbox

https://www.dropbox.com/s/t48rqemujn21q42/redirectpagescreenshot.png?dl=0

If you paste the complete form code it would be much easier to track down your issue.

What you posted doesnt give any info of what happens when submit is pressed.

Use the code button above (Looks like this <>) to add the code instead of just pasting it in.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.