简体   繁体   中英

How to open a PHP/form results page in a new window?

I have a form:

<form action="bar.php">
  <input type="hidden" name="foo" value="<?php SOME_STUFF(); ?>" />
  <input type="submit" />
</form>

which acts on a PHP script that generates a PDF from the form contents:

/* bar.php */
<?php
  $html = $_POST['foo'];
  $pdf->$writeHTML($html);
  $pdf->Output('bar.pdf');
?>

And my client would like this to open in a new window. I know HTML won't validate a target attribute for a form, so must I use JavaScript? And, where?

Try to insert target="_blank" into form tag

and read this http://www.tufat.com/script19.htm about output to 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM