Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,172,807 members, 7,886,167 topics. Date: Thursday, 11 July 2024 at 01:24 AM

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

Nairaland Forum / Science/Technology / Webmasters / pls gurus Help,inserting Hyperlinks Codes In Php (757 Views)

Inserting Ads (adsense, Buzzcity, Admob And Inmobi) To SMF Wap2 (mobile Version) / Inserting Adsense Into My Website / Inserting Hit Counter And Analogue Clock On Webpage (2) (3) (4)

(1) (Reply) (Go Down)

pls gurus Help,inserting Hyperlinks Codes In Php by j2much: 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)

Become A Website Traffic Consultant / Domain Regis & Web Hostin / Are This The Best Web Hosting Companies In Nigeria

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.