• Welcome to DNForum.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars
    If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the oldest global domain name community on the internet and continues to grow every day. There are over 45,000 domainers on DNForum doing everything from buying domains, selling domains, using our free in-house built tools, learning about domains and discussing domains. Take a minute and Register.

Wanted: Service Quick PHP Question

Status
Not open for further replies.

BobBob is verified member.

Jedi Master
DNF Moderator
The Originals
Legacy Platinum Member
Joined
Apr 8, 2002
Messages
3,146
Reaction score
75
I cannot seem to figure out how to do this or find it anywhere.

I need to open a link in a NEW browser window.

In HTML, you do it with:

a href=". . . " target="_BLANK"


In JavaScript, you do it with:

window.open(". . . ");

How do you do this in PHP?

I tried:
header('Window-target: NEW');
header('Location: http://. . . ');

But I got a "Headers already sent" error in the main document.

ACK! Help please!

-Bob
 
Why don't you just use javascript within the php document? That's the way I do it. Not sure if there is an actual php command, but I guess there must be.
 
Ah you cant do this in php... its an active element which means it can only be used in browser code.
 
Bob said:
I cannot seem to figure out how to do this or find it anywhere.

I need to open a link in a NEW browser window.
I tried:
header('Window-target: NEW');
header('Location: http://. . . ');

But I got a "Headers already sent" error in the main document.

ACK! Help please!

-Bob
Hey Bob, I'm no php guru, but I think the server is telling you you're resending http headers again, which it sounds like the server doesn't like.

I would pursue generating an html doc, with a meta equiv tag and research if there's an http header that will open a new window, similar to how the "refresh" will redirect. I definitely don't know what every one of the http headers are and do. I think there's about 60 or so, not including mime type headers.

Another possibility I'd experiment with would be to use php to generate a javascript doc that in turn executes and opens the new window.

I don't know if that helps or not. I'm probably more confused than you! :-)

WebCat
 
Try this Bob.

Code:
<?php
echo '<a href="http://www.dnforum.com" target="_blank">www.dnforum.com</a>';
?>
 
Drop me a pm if you ever have any PHP-questions or if the above didn't help you out. Am fairly experienced and don't mind helping out! (That goes for all of you)
 
Status
Not open for further replies.
Back
Top Bottom