Page 1 of 1

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

Posted: Mon Jan 05, 2009 11:31 am
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??

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

Posted: Mon Jan 05, 2009 11:44 am
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.

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

Posted: Mon Jan 05, 2009 11:54 am
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?

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

Posted: Mon Jan 05, 2009 3:03 pm
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.

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

Posted: Fri Jan 09, 2009 4:46 pm
by pengcamp
i wanted to redirect people there
thanks anyway, i figured it out using js