tags:

views:

119

answers:

2

There is some html text stored in the Database which I want to show in an html text area as it was in the Database.

Text in DB is:

<SPAN STYLE= "" >I should have known this....</SPAN>

but when I show it in the text area it gets displayed as:

I should have known this
</SPAN> 
">

I am filling the text area like so:

<textarea class="inputtext" name="content" value="<?=$row2['contentFull']?>">
+1  A: 

Because a textarea does not have a "value" attribute, you put the text between the opening and the closing tags:

<textarea class="inputtext" name="content">
<?=$row2['contentFull']?>
</textarea>

See http://www.w3schools.com/TAGS/tag%5Ftextarea.asp

karim79
+1  A: 

If you want to have a default value in a TEXTAREA you need to code it like this:

<textarea name="content"><?php echo $row2['contentFull']; ?></textarea>

It's because TEXTAREA does not have the value attribute nor is it a singular or unpaired tag like INPUT. It is instead a paired tag. One where you have to have both the opening and a closing tag.

Make sure also that unless you want an extra line break showing, to have the start of your output right after the opening TEXTAREA tag.

random