This topic is locked

Redirect to two places

4/5/2011 11:05:25 PM
PHPRunner General questions
Y
yksafo author

Hi,
Is it possible to redirect to two places.

I'm trying to use the below code in the "After RecordAdd" event to first open a new window which is suppose to be a receipt and the parent also goes to another page but I seem to be getting an error that:
Cannot modify header information - headers already sent by(output started at /www/.../oderDetails_events.php:92)
CODE:

echo "<script>window.open('depositReceipt_print.php?editid1=".$keys["oderDetailsID"]."');</script>";
header("Location: receiveReceipt_print.php?editid1=".$keys["oderDetailsID"]);

exit();


Thanks....

Sergey Kornilov admin 4/6/2011

Redirect should happen before any output.
I guess you can redirect first and on that page open a popup.

Y
yksafo author 4/6/2011



Redirect should happen before any output.
I guess you can redirect first and on that page open a popup.


It actually doesn't open the pop-up after the redirect....it just goes to the redirected page and nothing happens.

I'm guess after the redirect there is no more header information since it exits

header("Location: oderDetails_list.php?editid1=".$keys["orderID"]);

//exit();
echo "<script>window.open('depositReceipt_print.php?editid1=".$keys["oderDetailsID"]."');</script>";
Sergey Kornilov admin 4/6/2011

The code that opens the popup needs to be moved to one of events of the page where you redirect your user.
You cannot do both redirect and open page in popup in the same event. Redirect first and when that page is loaded display a popup.