Hi
I have the following code that I post a form to with 2 submit buttons. One has the value Save and the other Print.
If the user selects the Print button the page correctly loads, the print dialogue opens & after printing the page correctly closes. However if the user selects Save, even though the correct Open/Save dialogue is triggered, the page is never fully loaded and therefore does not close.
Anyone know how this could be achieved?
Cheers
[Peace][Pipe]
I have the following code that I post a form to with 2 submit buttons. One has the value Save and the other Print.
If the user selects the Print button the page correctly loads, the print dialogue opens & after printing the page correctly closes. However if the user selects Save, even though the correct Open/Save dialogue is triggered, the page is never fully loaded and therefore does not close.
Anyone know how this could be achieved?
Code:
<?php
if ($_POST["submit"] == "Save") {
header("Content-type: application/rtf");
header("Content-Disposition: attachment; filename=MFL_free_text.rtf");
header("Pragma: no-cache");
header("Expires: 0");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html>
<head>
<title>Self-Evaluation</title>
<style>
body { font-family:Arial, sans-serif; font-size:10pt;}
</style>
</head>
<body onload="self.close();">
<p><a href="javascript:self.close();">Close window</a></p>
<p><strong><?php echo $_POST["client"]; ?></strong></p>
<p><strong><?php echo $_POST["title"]; ?></strong></p>
<p><?php echo $_POST["free_text_area"]; ?></p>
<p><strong><?php echo $_POST["footer"]; ?></strong></p>
<? if ($_POST["submit"] == "Print") { ?>
<script>
self.print();
</script>
<? } ?>
</body>
</html>
Cheers
[Peace][Pipe]