Forum Moderators: coopster
I have a page which once you confirm with a button on a form posts info to the same page, turns the post variables into several lines of sql inserts and updates, and executes the queries.
I need to make this page return to another summary page which is easily enough done using the header command.
However I also need it to open a second page as a popup, which if it was a simple link i would just add a target tag to the href. but its not. i dont know. can anyone help?
page 1 is confirm details with a form,
hidden variables, and a submit button.
it submits to itself, and when the page loads
the code for stage 2 begins (stage was a hidden variable btw)
the code for stage 2 runs a bunch of mysql inserts and updates, then it redirects to a form page for printing.
Page 2 is specially formatted for printing out and looking good. it has NO links whatsoever. Javascript automatically brings up the print dialog box.
once the page is printed, i cant get back to the site without hitting the browsers back button, and when i do that, the page is out of date and you need to refresh and click retry to repost the variables. obviously i cant have this.
my solution was:
make page 1, after it has ran the sql, popup the printable page, and redirect back to page x on my site using the php header command.
the popup CANNOT be an onclick javascript because the page automatically redirects etc after the sql
maybe it can be an onload but it has to run the sql queries first
hope this helps :-)
<html>
<body>
<script>
// open for print in new window
window.open ("http://www.example.com/print/page/here.php","mywindow");
// load another page in current window
location.href='http://www.example.com/summary/page.php';
</script>
</body>
</html>
Or, as i written in previous post you could just add <script> window.open ("http://www.example.com/print/page/here.php","mywindow"); </script>
in your summary page. You will not have to redirect in this case.