/    Sign up×
Community /Pin to ProfileBookmark

insert php values into textarea

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!

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@jacen6678Aug 26.2003 — <textarea rows = 10 cols = 50 wrap = virtual>

<?= htmlspecialchars($row[user_description]) ?>

</textarea>

and, you mihgt need quotes around user_description
Copy linkTweet thisAlerts:
@moondanceauthorAug 26.2003 — 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........)>

????
Copy linkTweet thisAlerts:
@jacen6678Aug 26.2003 — 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.
Copy linkTweet thisAlerts:
@Daot_LagorilleAug 26.2003 — 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>
Copy linkTweet thisAlerts:
@moondanceauthorAug 27.2003 — thanks for your replies.

?
×

Success!

Help @moondance spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...