Stripping textarea code...

Discussion in 'PHP' started by redhits, Nov 22, 2006.

  1. #1
    I am having a problem , i would like to print out some text... in a <textarea></textarea> ... the problem is that the code is bracking... because in the textarea i will have html code, that will also include the word </textarea>
     
    redhits, Nov 22, 2006 IP
  2. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    change < to &lt;
    you can make > &gt; if you want
     
    lbalance, Nov 22, 2006 IP
    redhits likes this.
  3. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you are working with PHP, just run the text to be displayed in the texarea through the htmlentities function. This example is from the php.net website:

    $orig = "I'll \"walk\" the <b>dog</b> now";
    $a = htmlentities($orig);
    echo $a; // I'll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now
    PHP:
     
    clancey, Nov 22, 2006 IP
    redhits likes this.
  4. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #4
    thx you a lot
     
    redhits, Nov 22, 2006 IP