Jump to content


Photo

Stop PHP Comments.... if($sponser == http://)


  • Please log in to reply
1 reply to this topic

#1 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 02 September 2006 - 01:31 PM

I have an address I want to add into an if statement, which will be:
if($sponser == http://) {
echo " "
}
else {
<a target="_blank" href="<?=$sponser?>">Click to View Website</a>
}

So if there is no website it won't show "Click to view website" but the problem is http:// creates a PHP comment which stops it from working.

Thanks.
~ Mutley.

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 September 2006 - 01:38 PM

Like this instead, perhaps:

if($sponser != "http://") {
    echo '<a target="_blank" href="'. $sponser. '">Click to View Website</a>';
}

Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users