使用输入标签发送数据。我需要更大的区域来写评论,但是如何在按下按钮时在文本区域中发送评论?
<form action="action.php" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>your comment:<textarea name="comment" >Enter text here...</textarea></p>
<p><input type="submit" /></p>
</form>
第二部分
name: <?php echo htmlspecialchars($_POST['name']); ?>.
comment: <?php echo htmlspecialchars($_POST['comment']); ?>.
答案 0 :(得分:0)
(int)
if (isset($_POST['submitbutton']))
我针对此问题的代码:
<html>
<head></head>
<body>
<form action="#" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>your comment:<textarea name="comment" rows="HEIGHT" cols="WIDTH">Enter text here...</textarea></p>
<p><input type="submit" name="submitbutton"/></p>
<?php
if (isset($_POST['submitbutton']))
{
echo htmlspecialchars($_POST['name']);
echo htmlspecialchars($_POST['comment']);
}
?>
</form>
</body>
</html>