I'm new to php and am trying to duplicate some html code in php.
This is an example of code that I have that works.
echo "<a href = \"$url\">\"aloe.jpg\"</a>\n";
I can create the $url from mysql data but I haven't been able to figure out how to create an <img src of "aloe.jpg". Insted the word "aloe.jpg" appears when I run the script.
I checked the php manual and and googled just about phrase I could think might get some results. No luck!
Any help would be very appreciated.
Thanks
[SOLVED] href and image source
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
echo '<a href = "'.$url.'">'.$picname.'</a>\n';Code: Select all
echo "<a href = \"$url\">$picname</a>\n";that's because you are simply echoing out the image name itself instead of actually showing the image....chris100 wrote: I can create the $url from mysql data but I haven't been able to figure out how to create an <img src of "aloe.jpg". Insted the word "aloe.jpg" appears when I run the script.
Thanks
Code: Select all
echo "<a href = "$url">"aloe.jpg"</a>\n";Code: Select all
echo '<a href="'.$url.'"><img src="aloe.jpg"></a><br>';*curses php tag*
Code: Select all
echo '<img src="'.$url.'aloe.jpg"></a><br>';
Last edited by infolock on Mon Apr 04, 2005 7:40 pm, edited 6 times in total.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
echo '<a href="' . $url . '"><img src="' . $pic . '" /></a>' . "\n";- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: