Chandresh singh Chandresh singh - 1 year ago 124
MySQL Question

how to set href tag to hold php variable and that variable contains a link to a different site?

I have a mysql DB which directly stores links to different sites.
I fetch the link from DB and store it in a variable like this:

$tdl = $row["file"];


Now this $tdl has the link to a different site...
I use html tag to display it like this..:

<a href="<?php echo $tdl ;?>" target="_blank"><b><u>VIEW PDF DOCUMENT</b></u></a>


Now when i click on the link "VIEW PDF DOCUMENT" the new site is opened (eg http://www.IneedTOgoHERE.com). This works in local host but when I put my site online, It appends the link with my domain name, eg. http://www.myExampleDomain.com/www.IneedTOgoHERE.com.

I want to open just http://www.I need To go Here.com. How do I do that?

Answer Source

Try This,

<a href="<?php echo "http://".$tdl ;?>" target="_blank"><b><u>VIEW PDF DOCUMENT</u></b></a>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download