467,074 Members | 975 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,074 developers. It's quick & easy.

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

Haitashi
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:
Expand|Select|Wrap|Line Numbers
  1. <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!
Mar 13 '08 #1
  • viewed: 2252
Share:
1 Reply
Haitashi
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:
Expand|Select|Wrap|Line Numbers
  1. <div style="overflow:scroll; width:100px;height:100px">
  2. <?php echo($haitashiVariable); ?>
  3. </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.
Mar 13 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Bill Sneddon | last post: by
6 posts views Thread by SRafiq@opinionsite.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.