How to display PHP variable inside Textarea

Unlike input fields, textarea does not use value.

The text we want to display should be placed between <textarea> and </textarea> tags.

In PHP, we can easily echo our variable between these tags.

Here is how to display a PHP variable in textarea:


$myVariable = 'Text in textarea';


<textarea><?php echo $myVariable; ?></textarea>