Reputation: 131
I am trying to store some link in database, for example www.google.com
. Lets say after pulling the value from database I stored it in $url
. Now, I am trying to set the link by doing
echo "<a href=$url>link</a>"
Now, the problem - whenever I click on the link the links goes to www.mydomain.com/www.google.com
Upvotes: 1
Views: 2085
Reputation: 3806
This might depend on the browser, but links are always relative and outbound links should include the correct http
or https
protocol specification.
Upvotes: 2
Reputation: 2399
You have to add http://
to the beggining of the link. EG:
echo "http://$url";
:)
Upvotes: 5