firedrop84 Posted March 26, 2006 Share Posted March 26, 2006 I just would like to ask if anyone knows how I am able to display the value of any variable into a textarea. Quote Link to comment https://forums.phpfreaks.com/topic/5846-didplay-into-a-textarea/ Share on other sites More sharing options...
toplay Posted March 26, 2006 Share Posted March 26, 2006 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 Link to comment https://forums.phpfreaks.com/topic/5846-didplay-into-a-textarea/#findComment-20839 Share on other sites More sharing options...
freakus_maximus Posted March 28, 2006 Share Posted March 28, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/5846-didplay-into-a-textarea/#findComment-21638 Share on other sites More sharing options...
wildteen88 Posted March 28, 2006 Share Posted March 28, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/5846-didplay-into-a-textarea/#findComment-21641 Share on other sites More sharing options...
toplay Posted March 28, 2006 Share Posted March 28, 2006 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); Quote Link to comment https://forums.phpfreaks.com/topic/5846-didplay-into-a-textarea/#findComment-21684 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.