Ilyas
Ilyas

Reputation: 43

how to redirect php page with parameters into new tab or window

I have print option in my application. When user click on print button the print page should be open in another tab/window.

Again I am sending some parameters with print page as it contain dynamic values.

to do so i have used php header as

header("location:Delivery_form.php?cnno=$cnno&copies='$nocopy'");

but it is redirecting in parent page. and javascript window.open as

echo "<script type=\"text/javascript\">".
        "window.open('Delivery_form.php?cnno='".$cnno."&copies=".$nocopy ")".
             "</script>";

please help me to achieve this funcnality.

Upvotes: 3

Views: 35311

Answers (2)

The php header should be :

header("location:Delivery_form.php?cnno=".$cnno."&copies=".$nocopy);

Script

echo "<script type=\"text/javascript\">
        window.open('Delivery_form.php?cnno=".$cnno."&copies=".$nocopy."', '_blank')
    </script>";

Upvotes: 4

plexcell
plexcell

Reputation: 1677

Try this

echo "<script type=\"text/javascript\">
        window.open('Delivery_form.php?cnno=".$cnno."&copies=".$nocopy."', '_blank')
    </script>";

Upvotes: 3

Related Questions