Show HTML in a textarea

Hi All

I am pulling a terms and conditions page from my DB and showing it in a textarea.

Is there anyway to show it with the HTML formatting.

Any help would be great.

Many Thanks


give us your code and some database info first, we need something to see off of it, cant just read your mind inside the db

This is more a general question but sure, here’s some code…

$termsandconditions = "<P align=left><B>1.</B> Information on prizes and how to enter form part of these terms and conditions.</P>
<P><B>2.</B> Entry into the competition deems acceptance of these Conditions of Entry.</P>

<textarea name='terms' cols='78' rows='8' class='formtext'>$termsandconditions</textarea>

This should really be moved to a HTML or CSS specific area within the forum, but here goes anyway:

You can’t put HTML content within a text area because it’s displayed as-is (e.g. HTML source).

What you can do is to create a div of a fixed size with the overflow set to scrolling, for example:

<style type="text/css">
  width: 20em;
  height: 15em;
  overflow: auto;

<div class="terms">
  Terms and conditions<br />
  <br />
  <br />
  Blah blah.. <img src="/whatever.png" alt="blah" />

Note that the ‘auto’ value for overflow means the browser will only display scroll bars if the content is wide/tall enough to be scrolled in that direction, to force scrolling you can use the ‘scroll’ value instead.


  • Harry :stuck_out_tongue:


Hookem: please… be creative and use those brain cells :smiley:

Perfect, Thanks a lot!