Click to See Complete Forum and Search --> : insert php values into textarea
moondance
08-26-2003, 11:00 AM
I'm developing a simple site where user information is retrieved and displayed on the page.
For a description section, a large amount of text is retrieved, to be displayed in a textarea. But I can't figure out how to get the value from mysql to show up in the text area.
I've got:
<textarea value = htmlspecialchars($row[user_description]) rows = 10 cols = 50 wrap = virtual></textarea>
But it shows nothing.
Help!
jacen6678
08-26-2003, 11:03 AM
<textarea rows = 10 cols = 50 wrap = virtual>
<?= htmlspecialchars($row[user_description]) ?>
</textarea>
and, you mihgt need quotes around user_description
moondance
08-26-2003, 11:16 AM
that half works - the script is in the actual php file, so i might not need the <? ?> for the php line.
Getting there:
echo ("td width = 100px><textarea rows = 10 cols = 50 wrap = virtual> htmlspecialchars($row[user_description])></textarea></td>");
displays the user description, but also has at the top:
htmlspecialchars( user description text........)>
????
jacen6678
08-26-2003, 11:25 AM
Heh... you should have said so...
echo "...<textarea rows = 10 cols = 50 wrap = virtual>". htmlspecialchars($row[user_description])."</textarea></td>";
or
echo "td width=100px><textarea rows=10 cols=50 wrap=virtual>";
echo htmlspecialchars($row[user_description]);
echo "</textarea></td>";
btw, you dont need to wrap the things to be echo'ed in ( ). Echo is not a function.
Daot Lagorille
08-26-2003, 11:29 AM
I assume you have your mysql statment and the retrieved records in a set of variables, so it should be as easy as:
<textarea name="name"><?php echo $varTextContent; ?></textarea>
moondance
08-27-2003, 02:41 AM
thanks for your replies.
;)