使用 PHP 在 textarea 中设置文本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3593472/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Set text in textarea with PHP
提问by Robert de Klerk
How can I set the text of a textarea object in PHP, is it necessary to use javascript.
如何在 PHP 中设置 textarea 对象的文本,是否需要使用 javascript。
I want to have one textarea, and be able to set the text that is displayed at different times.
我想要一个textarea,并且能够设置不同时间显示的文本。
Thanks
谢谢
采纳答案by Ian Henry
If you want to change the text after it has been downloaded by the client (for example, have the text change every five seconds or something), you must use javascript. PHP is only used for server-side generation of the markup that the client downloads.
如果要在客户端下载文本后更改文本(例如,每 5 秒更改一次文本或其他内容),则必须使用 javascript。PHP 仅用于服务器端生成客户端下载的标记。
回答by Peter Ajtai
<textarea rows="2" cols="20">
<?php echo "Your text here. This can be dynamically created with PHP
when the page is served."; ?>
</textarea>
So, the textarea can be filled with PHP, but if you want to change the textarea after the page has loaded.... once it's out of the hands of the server, then you have to use Javascript.
所以,textarea可以用PHP填充,但是如果你想在页面加载后改变textarea....一旦它脱离了服务器的控制,那么你必须使用Javascript。
回答by yasin
<td>
<textarea rows="4" cols="10">
<?php
echo $row['baddress'] ;
?>
</textarea>
</td>
<?php
echo $row['baddress'];
?>
It must be call separately here baddress is the column name of my data base
必须单独调用这里 baddress 是我的数据库的列名