1

I am trying to display the value of a textarea in a form that will enable someone to edit its value. The textarea displays nothing but I checked the database and there is a 2 sentence value. Here is the code I am using:

<textarea rows="5" cols="55" name="P1Bio" value="<?=$record['P1Bio']?>">
</textarea>

P1Bio is the field. On the same form, I am also getting values from textboxes and it is working fine. Here is the code that I am using for text boxes:

<input type="text" size="90" name="P1Email" value="
<?=$record['P1Email']?>">

Can someone please tell me why the textarea is not showing anything? Thank you.

dr1054
  • 89
  • 1
  • 4
  • 10

4 Answers4

6

There is no value attribute with textareas.

You need to put the content in between the open and closing tags like this:

<textarea rows="5" cols="55" name="P1Bio"><?=$record['P1Bio']?></textarea>
jszobody
  • 28,495
  • 6
  • 61
  • 72
1

Your php needs to be inside the text area

 <textarea><?= $record['P1Bio'] ?></textarea>
Clint
  • 443
  • 3
  • 13
1

Try

<textarea rows="5" cols="55" name="P1Bio><?=$record['P1Bio']?></textarea>
0

Unlike texts (like <input type="text">), content in textareas are inside the tags:

<textarea rows="5" cols="55" name="P1Bio" value=""><?=$record['P1Bio']?></textarea>

Some information regarding this: HTML Tag

Gynteniuxas
  • 7,035
  • 18
  • 38
  • 54