₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,329,826 members, 8,442,444 topics. Date: Friday, 10 July 2026 at 08:11 AM

Toggle theme

pls gurus Help,inserting Hyperlinks Codes In Php - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmasterspls gurus Help,inserting Hyperlinks Codes In Php (835 Views)

1 Reply (Go Down)

pls gurus Help,inserting Hyperlinks Codes In Php by j2much(op): 3:29pm On May 05, 2009
pls gurus how do i insert a hyperlink in php,using the 'echo 'command,i'v tried

echo "a href="www.xyz.com">click here</a>";

but it didn't work so gurus i need yr help
Re: pls gurus Help,inserting Hyperlinks Codes In Php by WebJunior(m): 7:51pm On May 07, 2009
Try this as well,


<?php print( '<a href="http://www.xyz.com/">click here</a>' ); ?>  OR   <?php echo( '<a href="http://www.xyz.com/">click here</a>' );



Hope this helps.
Re: pls gurus Help,inserting Hyperlinks Codes In Php by Nobody: 2:51pm On May 09, 2009
echo "<a href="www.xyz.com">click here</a>";
there is no magic here, if you open a quote, then you must close it

by saying "<a href="
to PHP, u just opened and closed a quote, anything other than a concatenation character will give an error

if you need to add another, then you will need to cancatenate (no be big grammer, it means patch-patch) and PHP's way of concatenation is to use full stop(.)
Thats off topic anyway

You are trying to use both html and php's quotes, the best way around this is to use single quote for the html quote and double for PHP like this

"<a href='www.xyz.com'>click here</a>"

or you escape the nested quote like this

"<a href=\"www.xyz.com\">click here</a>" -in this case, php will understand the backslash as an escape character and will output the double quote
and since html is a browser language, then leave the rest for the browser to interpret.
Re: pls gurus Help,inserting Hyperlinks Codes In Php by biggjoe(m): 5:18pm On May 09, 2009
shouldnt it be

echo "<a href=\"xyz.com\">Click</a>";
Re: pls gurus Help,inserting Hyperlinks Codes In Php by Nobody: 12:15pm On May 10, 2009
sorry, i left out the opening tag same way he did, i've modified it
Re: pls gurus Help,inserting Hyperlinks Codes In Php by segsalerty(m): 12:10pm On May 11, 2009
you can do this

print<<<weblink
<a href="www.xyz.com">Click here</a>
weblink;


That should work
1 Reply

Inserting Ads (adsense, Buzzcity, Admob And Inmobi) To SMF Wap2 (mobile Version)Inserting Adsense Into My WebsiteInserting Hit Counter And Analogue Clock On Webpage234

Qgroup4u.com Test, Learn, Study & Speak The English Language OnlineCss Test 3Php/mysql,asp/sql