Jump to content

Archived

This topic is now archived and is closed to further replies.

firedrop84

Didplay into a textarea

Recommended Posts

I just would like to ask if anyone knows how I am able to display the value of any variable into a textarea.

Share this post


Link to post
Share on other sites
Example:

... name="var_name" value="<?PHP echo $my_value; ?>" ...

Look into perhaps using htmlentities() depending on what you're putting in the value area:

[a href=\"http://us3.php.net/htmlentities\" target=\"_blank\"]http://us3.php.net/htmlentities[/a]

Share this post


Link to post
Share on other sites
[!--quoteo(post=358524:date=Mar 26 2006, 09:46 AM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ Mar 26 2006, 09:46 AM) [snapback]358524[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Example:

... name="var_name" value="<?PHP echo $my_value; ?>" ...

Look into perhaps using htmlentities() depending on what you're putting in the value area:

[a href=\"http://us3.php.net/htmlentities\" target=\"_blank\"]http://us3.php.net/htmlentities[/a]
[/quote]


I may be incorrect on this, so catch me if I am toplay. But I didnt think you could declare a "value=" for a text area. I know you can with a text input field. See the snippet below:

[code]
    <body>
        <P>My Text Field</P>
        <P><INPUT id="Text1" type="text" name="Text1" value="<? echo $solution; ?>"></P>
        <P> </P>
        <P>My Text Area</P>
        <P><TEXTAREA id="Textarea1" name="Textarea1" rows="2"                 cols="20"><? echo $myvar; ?></TEXTAREA></P>
    </body>
[/code]

As I said, I may be wrong, but I have never been able to use the "value=" parameter for a TEXTAREA. This always works.

Share this post


Link to post
Share on other sites
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]As I said, I may be wrong, but I have never been able to use the "value=" parameter for a TEXTAREA. This always works.[/quote]Beacuse the textare tag is not part of the <input> tag family and so has an opening and closing tag just like the paragraph tag.

Share this post


Link to post
Share on other sites
I didn't take firedrop question literally. Yes, that's what you would do with a text area.

FYI: If you have html to display in the input/textarea or any characters that could get interpreted as part of the html syntax (i.e. <), then it's best to do: echo htmlentities($var);

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.