设置HTML表单textarea的值?

时间:2022-11-12 12:15:02

I'm using the following to set the value of a text area..

我正在使用以下设置文本区域的值..

<?php
$message = $_REQUEST['message'];
?>
<br/><b>Description</b><br/>
<TEXTAREA NAME="message" COLS=40 ROWS=6 value="<?=$message;?>"></TEXTAREA><br/><br/>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />

but it doesn’t appear to be working. The value of message is not null. Does anyone have any idea why it's not filling the value?

但它似乎没有起作用。 message的值不为null。有谁知道为什么它没有填补价值?

2 个解决方案

#1


48  

Textarea has no value. You need to insert your message between the opening and closing tags.

Textarea没有任何价值。您需要在开始标记和结束标记之间插入消息。

<textarea><?php echo htmlspecialchars($message); ?></textarea>

#2


9  

<textarea name="message" cols="40" rows="6"><?=$message?></textarea>

Note: Make sure $message is properly sanitized and that short_open_tag is enabled. Otherwise, @fabric's accepted answer is a better answer.

注意:确保已正确清理$ message并启用了short_open_tag。否则,@ fabric的接受答案是一个更好的答案。

#1


48  

Textarea has no value. You need to insert your message between the opening and closing tags.

Textarea没有任何价值。您需要在开始标记和结束标记之间插入消息。

<textarea><?php echo htmlspecialchars($message); ?></textarea>

#2


9  

<textarea name="message" cols="40" rows="6"><?=$message?></textarea>

Note: Make sure $message is properly sanitized and that short_open_tag is enabled. Otherwise, @fabric's accepted answer is a better answer.

注意:确保已正确清理$ message并启用了short_open_tag。否则,@ fabric的接受答案是一个更好的答案。