Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Help me make an image clickable.

images php coding issues or problems here.

Moderators: macek, egami, gesf

Help me make an image clickable.

Postby rfcamat » Tue Mar 15, 2011 5:28 pm

Hi,

Please help me make the following image clickable:

<?php

$image = "http://blog.tonerboss.com/wp-content/uploads/2011/03/TB-Banner-600by174banner.jpg";
Echo "<img src=".$image." Style=width:575px;height:230px;>" ?>


It is currently not clickable. Thank you.
rfcamat
New php-forum User
New php-forum User
 
Posts: 4
Joined: Tue Mar 15, 2011 5:25 pm
Location: Brea, California

Re: Help me make an image clickable.

Postby Nullsig » Tue Mar 15, 2011 5:52 pm

Please see my response to your post in the other thread. If my recommendation doesn't solve your problem and you need help with the other situation I proposed then just post your reply here and I will help you out as it is then a completely new topic.
User avatar
Nullsig
php-forum Fan User
php-forum Fan User
 
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: Help me make an image clickable.

Postby rfcamat » Tue Mar 15, 2011 6:00 pm

Hi Nullsig,


So the code will look like this:

<?php

$image = "http://blog.tonerboss.com/wp-content/uploads/2011/03/TB-Banner-600by174banner.jpg";
Echo "<a href="http://www.tonerboss.com"><img src=".$image." Style=width:575px;height:230px;></a>" ?>


Please correct me if I am wrong. Thanks you very much. :)
rfcamat
New php-forum User
New php-forum User
 
Posts: 4
Joined: Tue Mar 15, 2011 5:25 pm
Location: Brea, California

Re: Help me make an image clickable.

Postby Nullsig » Tue Mar 15, 2011 6:06 pm

almost there... you need to change the last line to:

Code: Select all
Echo "<a href='http://www.tonerboss.com'><img src='".$image."' Style='width:575px;height:230px;'></a>"; ?>


you can't use unescaped double quotes inside of an echo string. I changed the offending quotes to single quotes and added single quotes around the style and src arguements. Not necessary but its good coding.
User avatar
Nullsig
php-forum Fan User
php-forum Fan User
 
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: Help me make an image clickable.

Postby rfcamat » Tue Mar 15, 2011 6:26 pm

Thank you, it works great. I was amazed as a newbie in PHP.
rfcamat
New php-forum User
New php-forum User
 
Posts: 4
Joined: Tue Mar 15, 2011 5:25 pm
Location: Brea, California

Re: Help me make an image clickable.

Postby webinfopedia » Sat May 21, 2011 11:44 pm

In PHP, first the coding syntax should be correct. you have to change Echo to echo, Style to style and put semicolon at the end.
Code: Select all
<?php
$image = "http://blog.tonerboss.com/wp-content/uploads/2011/03/TB-Banner-600by174banner.jpg";
echo "<a href='www.webinfopedia.com'><img src=".$image." style='width:575px;height:230px;' /></a>";
?>
User avatar
webinfopedia
New php-forum User
New php-forum User
 
Posts: 84
Joined: Sat May 21, 2011 10:26 pm


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.