CodeIgniter Forums
link for website - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: link for website (/thread-12068.html)



link for website - El Forum - 10-04-2008

[eluser]PHP Programmer[/eluser]
I am trying to add a link by using anchor() function.
I have a string say "Click Here" and I want to establish a link on it say www.google.com
I am doing it like:
anchor("$search->url", "Click Here")

But I am conveyed to http://localhost/mySite/www.google.com because $search->url is assigned to www.google.com in my DB

How can make a link to www.google.com directly.

Please suggest


link for website - El Forum - 10-04-2008

[eluser]wiredesignz[/eluser]
add http:// to the stored url


link for website - El Forum - 10-04-2008

[eluser]elvix[/eluser]
there's also a helper function called prep_url() that will add the http:// only if it's necessary (in cases where you won't know if it's there or not, i.e., user inputted urls).

Check the manual for the url helper.