redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alliance
Forum Newbie
Posts: 8
Joined: Sun Nov 14, 2004 1:22 pm

redirect

Post by alliance »

Hello,

I'm trying to redirect the browser after executing a task

I need the redirect to be as follow:

1. header... location $URL1 (open in a new window)
2. header... location $URL2 (open in current window)

with the $URL2 I don't have any problem, but the first to be opened in a new window give me some work.. Can anyone help ?

I may also use anyohter function if any is more suitable for this task.

Thanks

Samuel
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

have you considered looking in the PHP Manual? Or using the search function of this forum?
alliance
Forum Newbie
Posts: 8
Joined: Sun Nov 14, 2004 1:22 pm

Post by alliance »

yes, php.net no info about header into a new window and searches more than only this forum
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Since your handling browser elements, you may need to use JavaScript for this one. Can't help you here.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

use Javascripts

Code: Select all

document.myForm.target="_blank";
Note that a form can only be submitted once. You can pass the form-values to other functions via $_POST, $_GET or $_REQUEST.
alliance
Forum Newbie
Posts: 8
Joined: Sun Nov 14, 2004 1:22 pm

Post by alliance »

Thanks PatrikG,

As I can't return a form, destination URL may reject it here is what I used, hope this may help other too.

To open the $URL1 in a new window

Code: Select all

window.open('<?echo $URL1?>);
And to refresh the base window with $URL2, i use a meta tag refresh, as when testing with header function, I get an error message, header already sent (in the new window !)

A bit difficult but it's work.
Post Reply