Jump to content

redirect after making and emaling pdf


dolcezza

Recommended Posts

I am using fpdf to generate a pdf, then email it and give the user the chance to download it. Everything works great, except I cannot figure out how to get it to go back to the main site after this is completed. Any help appreciated.
I am only posting the end code in the interest of space.

[code]$pdf->MultiCell(0,5, 'The School can in no way decide not to compensate the author for her services.  If the school decides to cancel, they must pay the ConnectingAuthors the entire sum agreed upon within this contract.  Acts of nature are an exception to this; however, with the understanding that the school will reschedule for a future date.',0,1);

foreach($_POST['travelinc']  as  $value)  {
$travelincluded .= " $value, ";
} 
$pdf->MultiCell(0,5, 'Travel includes ' .  $travelincluded .  ' not to exceed the following amount: $' . $travelexp,0,1);
$pdf->Output($filename);
$pdf->Output();

include("olafsmailer.php");

$my_file = "bookingconfirmation.pdf";
$my_path = $_SERVER['DOCUMENT_ROOT']."/admin/";
$my_name = "Connecting Authors";
$my_mail = "mail.connectingauthors.com";
$my_replyto = "[email protected]";
$my_subject = "Connecting Authors booking confirmation attached.";
$my_message = "Thank you for booking your event with Connecting Authors. Attached you will find a copy of your events information.\r\nPlease retain it for your records.\r\n\rSusan B. Katz\r\n\[email protected]";
mail_attachment($my_file, $my_path, $email.",[email protected],[email protected]", $my_mail, $my_name, $my_replyto, $my_subject, $my_message);

 

This is the mail script:

function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {

    $file = $path.$filename;

    $file_size = filesize($file);

    $handle = fopen($file, "r");

    $content = fread($handle, $file_size);

    fclose($handle);

    $content = chunk_split(base64_encode($content));

    $uid = md5(uniqid(time()));

    $name = basename($file);

    $header = "From: ".$from_name." <".$from_mail.">\r\n";

    $header .= "Reply-To: ".$replyto."\r\n";

    $header .= "MIME-Version: 1.0\r\n";

    $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";

    $header .= "This is a multi-part message in MIME format.\r\n";

    $header .= "--".$uid."\r\n";

    $header .= "Content-type:text/plain; charset=iso-8859-1\r\n";

    $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";

    $header .= $message."\r\n\r\n";

    $header .= "--".$uid."\r\n";

    $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here

    $header .= "Content-Transfer-Encoding: base64\r\n";

    $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";

    $header .= $content."\r\n\r\n";

    $header .= "--".$uid."--";

   

}

?>[/code]

Link to comment
https://forums.phpfreaks.com/topic/86878-redirect-after-making-and-emaling-pdf/
Share on other sites

The code you decided to post for us doesn't actually show it outputting any headers. So, it's hard to say what you're doing exactly.

 

Generally, header() with location won't work with other headers.

 

You can always just display a page with a link for them to click on so they can then go (redirected) to the page you want them to be at. Also, you might be able to do it with JavaScript.

 

Good luck.

 

 

 

maybe it would help if you(or anyone else) can see what I am trying to do?

 

http://www.connectingauthors.com/admin/eventform.php?id=ed636e043d8500925fd36bb479b2c019 is a test page, it is a dynamic form for the user to fill out. (This is the page that code is on). It fills out any info already in the database, the user fills out the rest and hits "submit".(It's ok to hit submit)

Once submitted, it generates the pdf, emails it and gives you a prompt to download the pdf. I want this form to go away so they don't try to fill it out again.

I didn't want to post too much code, since the rules don't like it.

Thanks for your response.

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.