This topic is locked

I need to open a page in a separate window

7/8/2008 5:02:33 AM
PHPRunner General questions
T
thesofa author

OK, as a continuation of my saga to get a page printed automatically, I have re-thought my ideas and this is what I would like to happen:-
User clicks on Add New

User fills in details of the new item

User clicks on Save
now for the good bit, main page reverts to the page before the clicking of the Add New button, by using this code

header("Location: nd_pupils_list.php?a=return");

exit();


also the print friendly page should open, currently done with this code

header("Location: 4Letter_print.php?recordid=".$keys["id_det"]);

exit();


At the moment I can go back to the list with the first bit of code or I can go to the printer friendly page with the second bit of code, is there any way I can get both to happen, so the main database page reverts to the list page AND a separate window with the print friendly page opens to allow the page to be printed?

The alternative is to get the printer friendly page to be called and printed out without any intervention from the user at all, then revert to the list page.

That is the absolute golden objective.

Any help please

J
Jane 7/8/2008

Hi,
use JavaScript code in your event for this purpose.

T
thesofa author 7/9/2008

Hi,

use JavaScript code in your event for this purpose.



have you got a working example of opening the print page from javascript please?

J
Jane 7/9/2008

Here is a sample:

?><script>

window.open('tablename_print.php?recordid=<?php echo $keys["id_det"]?>');

window.location.href='tablename_list.php';

</script><?php

T
thesofa author 7/9/2008

Here is a sample:




Once again, spot on solution, many thanks indeed!