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
kebo
Forum Newbie
Posts: 9 Joined: Mon Aug 28, 2006 9:16 am
Post
by kebo » Mon Aug 28, 2006 7:15 pm
new to php here.....please excuse the...well lack of knowledge of the obvious....
how would I insert a link such as
Code: Select all
echo <a href="www.google.com"> www.google.com</a>
into php code?
thanks
kevin
olegkikin
Forum Newbie
Posts: 12 Joined: Wed Jun 21, 2006 10:01 pm
Post
by olegkikin » Mon Aug 28, 2006 7:18 pm
At least two ways:
1)
Code: Select all
echo "<a href=\"http://www.google.com\">www.google.com</a>";
2)
Code: Select all
?>
<a href="http://www.google.com">www.google.com</a>
<?
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Mon Aug 28, 2006 7:25 pm
My favorite...
Code: Select all
echo '<a href="htp://www.google.com">www.google.com</a>';
Then you don't have to escape your quotes.
kebo
Forum Newbie
Posts: 9 Joined: Mon Aug 28, 2006 9:16 am
Post
by kebo » Mon Aug 28, 2006 7:43 pm
excellent...thanks for the quick reply.....
kevin
jabbaonthedais
Forum Contributor
Posts: 127 Joined: Wed Aug 18, 2004 12:08 pm
Post
by jabbaonthedais » Mon Aug 28, 2006 7:50 pm
Everah wrote: My favorite...
Code: Select all
echo '<a href="htp://www.google.com">www.google.com</a>';
Then you don't have to escape your quotes.
Cool, I didn't know you could do that! I normally do it with single quotes in the html. I guess thats dangerous for browser compatability though.
Code: Select all
echo "<a href='htp://www.google.com'>www.google.com</a>";
kebo
Forum Newbie
Posts: 9 Joined: Mon Aug 28, 2006 9:16 am
Post
by kebo » Mon Aug 28, 2006 8:00 pm
so....lets see if I understand....
If I want to output html is php, I use echo and <....>....</> ?
what do I do if I want to output a "<" such as if I am creating an xml doc ?
for example, i want to ouptut somthing like
<Name> MyName </Name> ?
thanks
kevin