izzy Posted June 29, 2006 Share Posted June 29, 2006 Hi,I'm trying to display a bit of HTML code on my page so my users can copy this to their websites if they want to.It is supposed to be a direct link to their own userpage on my site.This is what i want to display on my page. In plain text <a href="http://www.mypage.com/index.php?id=<?php echo"$id";?>"<img src="http://www.mypage.com/bnt-logo.png"</a>Every way i've tried it just keeps recognising parts as HTML or PHP.Can someone tell me how to fix this problem? Quote Link to comment https://forums.phpfreaks.com/topic/13191-source-code-displayed-in-plain-text/ Share on other sites More sharing options...
wildteen88 Posted June 29, 2006 Share Posted June 29, 2006 Use htmlentities, function ie:[code]$str = '<a href="http://www.mypage.com/index.php?id=<?php echo"$id";?>"<img src="http://www.mypage.com/bnt-logo.png"></a>';echo htmlentities($str);[/code]Also how is <?php echo"$id";?> going to work? How is the $id variable going to be set on the other persons site they post it on? Quote Link to comment https://forums.phpfreaks.com/topic/13191-source-code-displayed-in-plain-text/#findComment-50764 Share on other sites More sharing options...
izzy Posted June 29, 2006 Author Share Posted June 29, 2006 [!--quoteo(post=389195:date=Jun 29 2006, 12:45 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 29 2006, 12:45 PM) [snapback]389195[/snapback][/div][div class=\'quotemain\'][!--quotec--]Also how is <?php echo"$id";?> going to work? How is the $id variable going to be set on the other persons site they post it on?[/quote]Sorry... that part is actually not supposed to be in plain text, that is supposed to echo/display the user id in question.Could you please help me with that too? Quote Link to comment https://forums.phpfreaks.com/topic/13191-source-code-displayed-in-plain-text/#findComment-50766 Share on other sites More sharing options...
hvle Posted June 29, 2006 Share Posted June 29, 2006 do this, this is easiest and on top of my head:$id = 235435;$str = <<<BLOCK<a href="http://www.mypage.com/index.php?id=$id"<img src="http://www.mypage.com/bnt-logo.png"></a>BLOCK;echo htmlentities($str); Quote Link to comment https://forums.phpfreaks.com/topic/13191-source-code-displayed-in-plain-text/#findComment-50776 Share on other sites More sharing options...
izzy Posted June 29, 2006 Author Share Posted June 29, 2006 Thanx !!! Quote Link to comment https://forums.phpfreaks.com/topic/13191-source-code-displayed-in-plain-text/#findComment-50798 Share on other sites More sharing options...
hsncool Posted June 29, 2006 Share Posted June 29, 2006 OMGOSH!U GUYS HAV TO DO EVRYTHING THE HARDWAY DONT U!lol, all u gota dois insert this code into ur script.....[code]echo('<a href="http://www.mypage.com/index.php?id=' . $id . '"<img src="http://www.mypage.com/bnt-logo.png"</a>');[/code][b]how i did this ?[/b]put wat u want to b display in the "design" part of a blank dreamweaver doc, and then check what the code for it is!easy! Quote Link to comment https://forums.phpfreaks.com/topic/13191-source-code-displayed-in-plain-text/#findComment-50885 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.