Jump to content

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

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.