Jump to content
Sign in to follow this  
zamansoomro

php script redirect while sending pdf as attachement

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

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