Jump to content

PHP External Links


justlukeyou

Recommended Posts

Hi,

 

I have a peice of code which publishes an image with a link from my database.  However I cant get it to use external links.  My code is:

 

echo "<a href=\"" .$link . "\">
<img src=\""   .$image ."\" />  </a><BR />";

 

I have tried all the options I can think of but I cant get it work.  Can anyone advise please?

Link to comment
https://forums.phpfreaks.com/topic/226897-php-external-links/
Share on other sites

What are the values of $link and $image?  There's no need for all that string concatenation BTW; it just creates more opportunities for errors.

 

echo "<a href=\"$link\">
<img src=\"$image\" /></a><BR />";

Link to comment
https://forums.phpfreaks.com/topic/226897-php-external-links/#findComment-1170734
Share on other sites

Hi,

 

I am trying to open a link from my database into a black tab.

 

Can I try this:  "target=\"_blank\">"

 

Will this use the " without messing up the PHP script?

 

Yep, adding the target attribute to the anchor tag should work. Note that this should open the link in a new window (depending on the browser settings). I don't know if there is a way to open the link in a new tab. I think that's up to the browser settings.

Link to comment
https://forums.phpfreaks.com/topic/226897-php-external-links/#findComment-1170956
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.