i'm using php and the need is to generate a pdf (i'm using fpdf) and an xml file with the same content. The pdf / xml is called by an html form with post parameter. Unfortunately gets downloaded only one page (pdf or xml). How can i solve the problem?
<form name="aaa" id="aaa" action="page1.php" method="POST" target="_blank">
....
<div><input type="submit" value="Insert"></div>
</form>
<?php
//do stuff and generate pdf
header("Location: page2.php");
?>
<?php
//do same stuff above and generate xml
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=test.xml");
header("Content-Type: text/xml");
header("Content-Transfer-Encoding: binary");
...
?>
i'd like on the form submission that both pdf and xml gets download
Thanks
Unfortunately that's not directly possible in one call. Each HTTP response can return for example one response, one file or a redirect.
Possible solutions:
src
is a page returning a file (kind of your page2
) - one iframe taget returns the xml the other pdf
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.