Mucca019
Mucca019

Reputation: 201

getting a value into my textarea

I'm using the following to set the value of a text area..

 <?php
 $description=$myrow["description"];
 ?>


 <textarea name="description" value="<?php echo htmlspecialchars($description); ?>" readonly></textarea>

but it doesn’t appear to be working. The value of message is not null. Does anyone have any idea why it's not filling the value?

Upvotes: 0

Views: 60

Answers (4)

Pupil
Pupil

Reputation: 23948

<textarea> does not have value attribute like <input type="text" value="InputValue"/>

Reference

From W3.org

Do like this:

<textarea name="description" readonly><?php echo htmlspecialchars($description); ?></textarea>

Upvotes: 3

Parth Chavda
Parth Chavda

Reputation: 1829

try this:

<textarea name="description"><?php echo htmlspecialchars($description); ?></textarea>

textarea value not defined using value property like value ="value" you need to do like <textarea> value </textarea>

Upvotes: 0

Shravan Sharma
Shravan Sharma

Reputation: 989

Try This

<?php
 $description=$myrow["description"];
?>


 <textarea name="description" readonly><?php echo htmlspecialchars($description); ?></textarea>

Upvotes: 0

Syed mohamed aladeen
Syed mohamed aladeen

Reputation: 6755

You need to put textarea value like this:

<?php
  $description=$myrow["description"];
?>


 <textarea name="description" readonly><?php echo htmlspecialchars($description); ?></textarea>  <!--passing the value between opening and closing textarea tags.-->

Upvotes: 1

Related Questions