GD_GRAY
asked on
Open pdf file in new window from one of two folders with php
I have two folders, one with pdf files starting with P in the Place folder, and the other with files starting with C in the Country folder.
If I use a link like
<a target='_blank' href='http//myhost.com/sor t.php?trip =$row[trip _number]'> " . $row['trip_number'] . "</a>
And than in the sort.php script use this
$trip = (isset($_GET["trip"])) ? $_GET["trip"] : 0;
What can I use to take the $_GET["trip"] and redirect the request to the right folder and open the file in the parent window. I was thinking that the if statement might work like
if $trip = p*.pdf than redirect to place/$trip, if not redirect to country/$trip and if it cant find the file echo not on file and not the 404
but as you see I have no idea how to write it. Also any other way of doing this is fine if you have one. This is all I could come up with.... Thanks
If I use a link like
<a target='_blank' href='http//myhost.com/sor
And than in the sort.php script use this
$trip = (isset($_GET["trip"])) ? $_GET["trip"] : 0;
What can I use to take the $_GET["trip"] and redirect the request to the right folder and open the file in the parent window. I was thinking that the if statement might work like
if $trip = p*.pdf than redirect to place/$trip, if not redirect to country/$trip and if it cant find the file echo not on file and not the 404
but as you see I have no idea how to write it. Also any other way of doing this is fine if you have one. This is all I could come up with.... Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow, your the bomb. thank you . I set the redirect up to use $dir/$trip and got what i need,
ASKER