Page 1 of 1

echo textarea field on form

Posted: Tue Jun 15, 2010 2:25 pm
by marnieg
I have a form with several fields on it and I want to echo the value from the table in the form. This is an update page for some data already in my database. I have used text fields before and the echo works fine, but if I define a textarea field

<textarea name="course_desc" cols="30" rows="10" value='<?php echo $course_desc; ?>' </textarea>

Its giving me an error saying that the value attribute is not allowed on textarea fields.

Re: echo textarea field on form

Posted: Tue Jun 15, 2010 2:30 pm
by AbraCadaver
It's not. Look up the textarea tag http://www.w3.org/TR/1999/REC-html401-1 ... tml#h-17.7:

Code: Select all

<textarea name="course_desc" cols="30" rows="10">
<?php echo $course_desc; ?>
</textarea> 

Re: echo textarea field on form

Posted: Tue Jun 15, 2010 3:46 pm
by marnieg
Thanks for your quick response. I removed the "value" attribute and just used the "echo php" code and it worked.

<textarea name='course_desc' cols='30' rows='10'></textarea> <?php echo $course_desc; ?></td>