probably an easy question, how do i link someone in php?

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
pengcamp
Forum Newbie
Posts: 3
Joined: Mon Jan 05, 2009 11:27 am

probably an easy question, how do i link someone in php?

Post by pengcamp »

my current code is this:

if($page=="SSL")
{header( "Location: https://www.e-junkie.com/ecom/gb.php?c= ... 8831&ejc=2" );}
else if ($page=="SSXL")
{header( "Location: https://www.e-junkie.com/ecom/gb.php?c= ... 8831&ejc=2"); }
else
{header( "Location: https://www.e-junkie.com/ecom/gb.php?c= ... 8831&ejc=2"); }



everything works, but i want to make it so the links open in a new window (target="_blank") not sure how i would do that, could anyone help??
User avatar
xpgeek
Forum Contributor
Posts: 146
Joined: Mon May 22, 2006 1:45 am
Location: Kyiv, Ukraine
Contact:

Re: probably an easy question, how do i link someone in php?

Post by xpgeek »

You need to rethink you app structure first.
To open link in new window you can use javascript window.open function and simple <a href="/some/link" target="_blank">link</a>

Location: do only redirect, it do not open any links.
pengcamp
Forum Newbie
Posts: 3
Joined: Mon Jan 05, 2009 11:27 am

Re: probably an easy question, how do i link someone in php?

Post by pengcamp »

sorry i am really green on some of this, but are you saying i should just ditch the php all together and go with JS? or keep the php and write JS under the if statements?
Schneider707
Forum Newbie
Posts: 9
Joined: Mon Dec 29, 2008 10:53 am

Re: probably an easy question, how do i link someone in php?

Post by Schneider707 »

Did you want to redirect people or to list the proper link? If its the latter, this would be the easiest way:

Code: Select all

if($page=="SSL"){
      echo "<a href=/"http://google.com/" target=/"_blank/">Google.com</a>" }
elseif ($page=="SSXL")
{echo "<a href=/"http://google.com/" target=/"_blank/">Google.com</a>" }
else
{echo "<a href=/"http://google.com/" target=/"_blank/">Google.com</a>" }
 
That will print out whichever link is necessary. I might have messed up escaping the quotation marks but you'll get it.
pengcamp
Forum Newbie
Posts: 3
Joined: Mon Jan 05, 2009 11:27 am

Re: probably an easy question, how do i link someone in php?

Post by pengcamp »

i wanted to redirect people there
thanks anyway, i figured it out using js
Post Reply