I have a script that has the code similar to the following:

if((isset($_POST['somefile']))
{
header("Location: http://www.url.com/somefile.pdf" );
}

This evaluates the selections of a form and will open the pdf file if the 'somefile' option is checked.

Now what I'm needing is basically two seperate IF statements to open two seperate PDF files in new windows.

For example, something like (except have it open each PDF in a new window...which I don't know how to do):

if((isset($_POST['somefile']))
{
header("Location: http://www.url.com/somefile.pdf" );
}

if((isset($_POST['somefile2']))
{
header("Location: http://www.url.com/somefile2.pdf" );
}

1) Is this possible?

2) How can I do it?

So when someone hits submit, I would want it to open somefile.pdf in one window, then open somefile2.pdf in another window.

You can't do this with PHP. It has be done with JavaScript or the HTML target attribute (which can only open one new window).

How about this...

I've read where I can put the HTML target code in the <form> attribute to make it open a new window.

Would it be possible to have it do that, evaluate part of the inputs and display the first PDF, then (after or simulatneously) redirect the parent page to another page that would re-evaluate the other inputs from my form?

Something like:

index.php > Contains the form with the target window

evaluate1.php > Will open in a new window with the PDF when the Submit button is pressed from index.php

index.php will then be redirected to evaluate2.php and open the 2nd PDF in the parent window

I hope that makes sense.

Even if its possible in Javascript, could someone help me with the code? I'm not too familiar with javascript.

This article has been dead for over six months. Start a new discussion instead.