echo textarea field on form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
marnieg
Forum Commoner
Posts: 65
Joined: Wed Mar 12, 2003 4:35 pm

echo textarea field on form

Post 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.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: echo textarea field on form

Post 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> 
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
marnieg
Forum Commoner
Posts: 65
Joined: Wed Mar 12, 2003 4:35 pm

Re: echo textarea field on form

Post 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>
Post Reply