How can I output html in a text area? Any work arounds?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Haitashi
    New Member
    • Jun 2007
    • 96

    How can I output html in a text area? Any work arounds?

    Hi guys!

    First off let me explain that I know it's not possible to output html in a text area and expect it to appear rendered. =)

    I'm trying to come up with a solution.

    Basically, I receive from my database a field that contains html.
    Something like:
    Code:
    <b>Awesome!</b> <br />
    I have a text area that outputs that. The point of having that in a text area field is so that all the code that comes back from the database is placed there and will get scrollbars if the output becomes to long for the text area size.

    Now, I would like to output from that field in the database the code with html rendered. So, in the example above, I'd see this in the text area:

    Awesome!

    How can I have the same "field with scrollbar" effect without using a text area?

    Ideas? Thanks in advance!
  • Haitashi
    New Member
    • Jun 2007
    • 96

    #2
    Gotta love CSS!

    Here's how to output rendered html into something that looks like a text area but really isn't!

    I'm outputting a PHP variable in here:
    Code:
    <div style="overflow:scroll; width:100px;height:100px">
    <?php echo($haitashiVariable); ?>
    </div>
    So, basically, you set the overflow CSS property to scroll and set the width and height to what you want. The result is something that looks like a text area but isn't. That means that it will output rendered html code and will automatically generate scroll bars on the side.

    Comment

    Working...