Text and a link??

  • Meron
  • Graduate
  • Graduate
  • Meron
  • Posts: 168

Post 3+ Months Ago

Hi,

What do I have to write if I want to add text
with a hyperlink in PHP??

Thank you :)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Mr. Wiggles
  • Graduate
  • Graduate
  • Mr. Wiggles
  • Posts: 160
  • Loc: Brizzle

Post 3+ Months Ago

You can include html in the php echo command, as long as yout text is within double quotes --> "within"
For example
PHP Code: [ Select ]
 
<?php
 
echo "Ozzu Forums this way <a href="http://www.ozzu.com">Ozzu Forums</a>";
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. echo "Ozzu Forums this way <a href="http://www.ozzu.com">Ozzu Forums</a>";
  5.  
  6. ?>
  7.  
  8.  

Will output :-
Ozzu forums this way Ozzu Forums
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Mr. Wiggles wrote:
You can include html in the php echo command, as long as yout text is within double quotes --> "within"
For example
PHP Code: [ Select ]
<?php
echo "Ozzu Forums this way <a href="http://www.ozzu.com">Ozzu Forums</a>";
?>
 
  1. <?php
  2. echo "Ozzu Forums this way <a href="http://www.ozzu.com">Ozzu Forums</a>";
  3. ?>
  4.  

Will output :-
Ozzu forums this way Ozzu Forums

Actually that is somewhat wrong, you would get a parse error if you do that. You need to do this:
PHP Code: [ Select ]
<?php
 
echo "Ozzu Forums this way <a href="http://www.ozzu.com">Ozzu Forums</a>";
 
?>
  1. <?php
  2.  
  3. echo "Ozzu Forums this way <a href="http://www.ozzu.com">Ozzu Forums</a>";
  4.  
  5. ?>

You must escape the double quotes if you use the double quotes to start and end the echo.
  • Mr. Wiggles
  • Graduate
  • Graduate
  • Mr. Wiggles
  • Posts: 160
  • Loc: Brizzle

Post 3+ Months Ago

Dang. An' I thought i was getting better? :p
  • Meron
  • Graduate
  • Graduate
  • Meron
  • Posts: 168

Post 3+ Months Ago

it is not working.

I get this: Ozzu Forums"; ?>

without a link.

Is it a matter where to put it??

thank you
  • Mr. Wiggles
  • Graduate
  • Graduate
  • Mr. Wiggles
  • Posts: 160
  • Loc: Brizzle

Post 3+ Months Ago

Check Scorpius' post as my original code was wrong. You have to put a \ in front of any " inside other doublequotes
  • Meron
  • Graduate
  • Graduate
  • Meron
  • Posts: 168

Post 3+ Months Ago

It worked.

Thanks All :)

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 103 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.