Textarea tag in php

Hi,

I have a problem with the following code.

$test="x<sup>3</sup>";
$output = "
<textarea name='example' rows='5' cols='5'>
$test
</textarea>
";
echo $output;

The <sup> </sup>is also appearing with the output.
how to display the power value?

can any one help me?

This is an html problem rather than a php problem. You wouldn’t expect a form field to render html. Lets say you were adding a Youtube embed code into a form for example. It wouldn’t work if the html was rendered. In what context is this being used? If the user is able to change the content consider using a WYSIWYG editor like tinyMCE. If the user isn’t supposed to change the value than use a different element to display the information, like a <div> or <p>.

Check out [fphp]sprintf/fphp and the extended ASCII table. :wink:


<textarea name="example" rows="5" cols="5">
  <?php printf('x&#37;c', 179); ?>
</textarea>