Jump to content

Displaying URL field from database causes duplicate link ... why?


simcoweb

Recommended Posts

I'm extracting a field from a MySQL database to display in a page as a hyperlink. The field contains a url like www.yoursite.com and i'm using this code to display it in an 'echo' statement containing  a large amount of HTML. Here's how the field is displayed:

[code]<b>•</b> <a class="body" href="$url">Click Here To Visit My Site</a>[/code]

The page displays it just fine as a hyperlink. But, the problem is when you mouse over it I get a duplicate URL like this:

[quote]http://www.yoursite.com/www.yoursite.com[/quote]

Which makes it appear as though it's treating the field data as a 'relative' link instead of just inserting it as it should. Ideas?
Link to comment
Share on other sites

heh.. never mind :)

I answered my own question. The problem was that the entries in the database didn't include http:// and were just www.yoursite.com. I updated that field to include the http:// and now they work properly.

Just an FYI for any others who want to include URL's into their pages :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.