Adding image to PHP tag

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

BlackFrancis

Thread Starter
Joined
Oct 21, 2006
Messages
233
I've tried to find a tutorial to help me with this, I can't seem to get this to work with simply adding the image with basic HTML nor the following:

PHP:
<img src="<?php echo img('image.jpg'); ?>" />
What I'm working with is this:

PHP:
<?php
global $user_login;
get_currentuserinfo();
if(!empty($user_login)){
echo "<a href='http://egress.ws/members/".$user_login."/profile/edit/group/1/'>Edit Profile</a>";
}
?>
To clarify: I'd like to replace the linked text above with an image. The normal routine of entering an image into a link doesn't go with this php command.

Thank you
 

colinsp

Colin
Joined
Sep 5, 2007
Messages
2,319
Give this a try

Code:
 <?php
global $user_login;
get_currentuserinfo();
if(!empty($user_login)){
echo "<a href='http://egress.ws/members/".$user_login."/profile/edit/group/1/'><img src='img.jpg'></a>";
}
?>
 

BlackFrancis

Thread Starter
Joined
Oct 21, 2006
Messages
233
Okay, I'm going to take a wild guess that the " character was the offending article.

It works. Thank you.
 

JiminSA

Jim
Joined
Dec 15, 2011
Messages
3,400
Your guess is not quite right - Colin was showing you that you hadn't specified an <img> tag to point to an image, your html was simply rendering the text "Edit Profile" as the clickable link... Your single and double quote handling was perfectly correct.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top