如何在 HTML textarea 中放置 PHP 值
How to place PHP value in HTML textarea
我正在尝试创建一个可以更新 MySQL 数据的页面。我希望 "current content" 已经在框中可见,以便可以对其进行更新。但是盒子太小了。
我试过使用输入,但它只在一行上有效,我要更新的数据是一个很长的段落。我尝试使用 textarea,但它似乎不起作用。
<input type="text" name="comment" value="<?php echo $currentCategory['comment']; ?>" />
<input type="submit" name="submit" value="Save Review" />
````````````````````````````````````````````````````````
<textarea type="text" name="comment" value="<?php echo $currentCategory['comment']; ?>" />
</textarea>
I want the paragraph to fit in the box.
正如评论中指出的那样,您正在错误地编写代码。你应该这样写:
<textarea type="text" name="comment"/>
<?php echo $currentCategory['comment']; ?>
</textarea>
如果希望文本区域字段不可编辑,则添加readonly
<textarea type="text" name="comment" readonly />
<?php echo $currentCategory['comment']; ?>
</textarea>
我正在尝试创建一个可以更新 MySQL 数据的页面。我希望 "current content" 已经在框中可见,以便可以对其进行更新。但是盒子太小了。
我试过使用输入,但它只在一行上有效,我要更新的数据是一个很长的段落。我尝试使用 textarea,但它似乎不起作用。
<input type="text" name="comment" value="<?php echo $currentCategory['comment']; ?>" />
<input type="submit" name="submit" value="Save Review" />
````````````````````````````````````````````````````````
<textarea type="text" name="comment" value="<?php echo $currentCategory['comment']; ?>" />
</textarea>
I want the paragraph to fit in the box.
正如评论中指出的那样,您正在错误地编写代码。你应该这样写:
<textarea type="text" name="comment"/>
<?php echo $currentCategory['comment']; ?>
</textarea>
如果希望文本区域字段不可编辑,则添加readonly
<textarea type="text" name="comment" readonly />
<?php echo $currentCategory['comment']; ?>
</textarea>