Jump to content


Photo

Didplay into a textarea


  • Please log in to reply
4 replies to this topic

#1 firedrop84

firedrop84
  • Members
  • PipPipPip
  • Advanced Member
  • 49 posts

Posted 26 March 2006 - 02:27 PM

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

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 26 March 2006 - 02:46 PM

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]



#3 freakus_maximus

freakus_maximus
  • Members
  • PipPipPip
  • Advanced Member
  • 177 posts

Posted 28 March 2006 - 04:23 PM

[!--quoteo(post=358524:date=Mar 26 2006, 09:46 AM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ Mar 26 2006, 09:46 AM) View Post[/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:

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

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

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 March 2006 - 04:31 PM

[!--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.

#5 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 28 March 2006 - 06:26 PM

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);






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users