Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1690

Re: How to "quote code" in PHP?

From "Mentalguy2k8" <Mentalguy2k8@gmail.com>
Newsgroups comp.lang.php
Subject Re: How to "quote code" in PHP?
Date 2011-05-20 09:44 +0100
Organization A noiseless patient Spider
Message-ID <ir59l6$6pj$1@dont-email.me> (permalink)
References <ir45oo$mik$1@dont-email.me> <ir55ie$ha3$1@dont-email.me>

Show all headers | View raw


""Álvaro G. Vicario"" <alvaro.NOSPAMTHANX@demogracia.com.invalid> wrote in 
message news:ir55ie$ha3$1@dont-email.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.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to "quote code" in PHP? "Mentalguy2k8" <Mentalguy2k8@gmail.com> - 2011-05-19 23:31 +0100
  Re: How to "quote code" in PHP? Jeff North <jnorthau@yahoo.com.au> - 2011-05-20 10:47 +1000
  Re: How to "quote code" in PHP? Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-19 21:47 -0400
  Re: How to "quote code" in PHP? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-05-20 09:34 +0200
    Re: How to "quote code" in PHP? "Mentalguy2k8" <Mentalguy2k8@gmail.com> - 2011-05-20 09:44 +0100
      Re: How to "quote code" in PHP? Michael Fesser <netizen@gmx.de> - 2011-05-20 10:54 +0200
        Re: How to "quote code" in PHP? Jeff North <jnorthau@yahoo.com.au> - 2011-05-20 20:21 +1000
          Re: How to "quote code" in PHP? "Mentalguy2k8" <Mentalguy2k8@gmail.com> - 2011-05-20 17:21 +0100

csiph-web