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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.