Page 1 of 1
html link
Posted: Mon Aug 28, 2006 7:15 pm
by kebo
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
Posted: Mon Aug 28, 2006 7:18 pm
by olegkikin
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>
<?
Posted: Mon Aug 28, 2006 7:25 pm
by RobertGonzalez
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.
Posted: Mon Aug 28, 2006 7:43 pm
by kebo
excellent...thanks for the quick reply.....
kevin
Posted: Mon Aug 28, 2006 7:50 pm
by jabbaonthedais
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>";
Posted: Mon Aug 28, 2006 8:00 pm
by kebo
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