Forum Moderators: coopster

Message Too Old, No Replies

Problem with links retrieved from Mysql with PHP

         

Whatsthis4

12:23 pm on Feb 21, 2006 (gmt 0)

10+ Year Member



My page is retrieving html links from my database. The links are written in the DB like this.

<a href="www.retrievedlink.com" target="_blank">Retrieved Link</a>

When the link shows up on the page it appears fine, but when I mouse over the link it shows in the browser status bar that it is stacked behind my domain url like this:

[mydomain.com...]

How do I stop my domain url from being inserted in the link.

If this is a stupid question please forgive me, I am very new to this. Thank you in advance for any help offered.

chrisjoha

12:56 pm on Feb 21, 2006 (gmt 0)

10+ Year Member



The answer is simple: unless you provide a protocol the url will be assumed to be relative to your server. So, simply add http:// :

<a href="http://www.retrievedlink.com" target="_blank">Retrieved Link</a>

Whatsthis4

1:27 pm on Feb 21, 2006 (gmt 0)

10+ Year Member



Wow, so obvious. Duh! I was looking way too hard for the answer. That explains why it worked on the server I had set-up on my computer but didn't when I uploaded it to my host. Somewhere in my sleepless pursuits, I dropped the http:// when I setup my DB on the host and copy/paste just compounded the issue. Thank you so much for your help.