gozbay.com Posted June 11, 2007 Share Posted June 11, 2007 Hello, I am not an expert on php but know some of the basics. My problem is that when I try to make the echo display an image it results in a syntax error. Below is the original code that displays text if $setts['swap_items']==1. <? if ($setts['swap_items']==1&&$auctionDetails['ownerid']!=$_SESSION['memberid']&&$auctionDetails['closed']!=1&&$auctionDetails['isswap']=="Y"&&$auctionDetails['deleted']!=1) { echo "<a href=\"swapitems.php?id=".$auctionDetails['id']."\">".$lang[offerswap]."</a>"; } ?> Would anyone be willing to show me how I would go about displaying a picture instead of the text? Any help would be greatly appreciated! -Zach Quote Link to comment https://forums.phpfreaks.com/topic/55149-solved-cant-get-eccho-to-display-an-image/ Share on other sites More sharing options...
B34ST Posted June 11, 2007 Share Posted June 11, 2007 what error are you getting? to echo an image: <?php echo '<img src="filename" alt="alternative text" />'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/55149-solved-cant-get-eccho-to-display-an-image/#findComment-272624 Share on other sites More sharing options...
gozbay.com Posted June 11, 2007 Author Share Posted June 11, 2007 I recieve this error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/gozbay/public_html/auctiondetails.php on line 688 when the echo looks like this echo "<a href=\"swapitems.php?id=".$auctionDetails['id']'<img src="images/SWAP.gif" alt="Offer a Swap Deal" />'; Quote Link to comment https://forums.phpfreaks.com/topic/55149-solved-cant-get-eccho-to-display-an-image/#findComment-272645 Share on other sites More sharing options...
pocobueno1388 Posted June 11, 2007 Share Posted June 11, 2007 Try this: <?php echo "<a href=\"swapitems.php?id=".$auctionDetails['id']."\"><img src=\"images/SWAP.gif\" alt=\"Offer a Swap Deal\" /></a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/55149-solved-cant-get-eccho-to-display-an-image/#findComment-272648 Share on other sites More sharing options...
gozbay.com Posted June 11, 2007 Author Share Posted June 11, 2007 Thank you very much,I knew i forgot something in there! Thanks again it works flawless now! -Zach Quote Link to comment https://forums.phpfreaks.com/topic/55149-solved-cant-get-eccho-to-display-an-image/#findComment-272655 Share on other sites More sharing options...
pocobueno1388 Posted June 11, 2007 Share Posted June 11, 2007 No problem, you just weren't concating the string correctly, and forgot to escape some quotes with backslashes. Don't forget to mark this thread as "solved" at the bottom left corner Quote Link to comment https://forums.phpfreaks.com/topic/55149-solved-cant-get-eccho-to-display-an-image/#findComment-272656 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.