FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to "quote code" in PHP?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to "quote code" in PHP? [message #174046 is a reply to message #174044] Fri, 20 May 2011 08:44 Go to previous messageGo to previous message
Mentalguy2k8 is currently offline  Mentalguy2k8
Messages: 3
Registered: May 2011
Karma:
Junior Member
""Álvaro G. Vicario"" <alvaro(dot)NOSPAMTHANX(at)demogracia(dot)com(dot)invalid> wrote in
message news:ir55ie$ha3$1(at)dont-email(dot)me...
> El 20/05/2011 0:31, Mentalguy2k8 escribió/wrote:
>> I'm trying to put together a little page with a form, so that users can
>> "translate" any URL into the correct format for posting on a forum.
>>
>> For instance, they want to share a link and type in "www.google.com"
>> (without quotes) and the form turns it into "<a
>> href="www.google.com"></a>" (without the beginning and end quotes) and
>> displays that as text, so that they can copy/paste it into the forum
>> post box. It will also include an image-posting version so that it adds
>> the "<img src" etc to an image URL.
>>
>> How do I "quote" the result so that it displays as plain text rather
>> than a mess? All I'm getting is a mess of blue code.
>
> The function to escape HTML is htmlspecialchars():
>
> http://php.net/htmlspecialchars
>
> Make sure you use it every time you print arbitrary plain text, not only
> in this case.

Thanks guys.

I'm getting in a mess here... I've written the page where the user inputs
the URL into a text box (as "url"), which passes the URL to the results page
as follows:

Cut and paste this link: <?php echo $_POST["url"]; ?>

which will display the text "cut and paste this link" along with the URL
that they entered. I need to add the <a href and the closing </a> around the
URL, without spaces, so that the user can copy the entire line and paste it
into the forum box.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Regular Expressions
Next Topic: php5-xdebug backported to squeeze from SVN 2.2.0 with trigger functionality
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 06:03:36 GMT 2024

Total time taken to generate the page: 0.04802 seconds