形成文本区域而不是输入

form textarea instead of input

我得到了这段代码,我想稍微修改一下。它是一种显示文本中单词数量的形式。我想改变输入(

我尝试了很多方法来使用文本区域,但要么没有输出,要么原始文本消失了。将名称更改为 id 无效,'normal way of using a textarea' 也是如此。

有没有办法用textarea替换input?必须保留的一件事是提交后文本区域中的文本需要可见。

感谢任何帮助。

<?php
error_reporting(0);
$inputtext = $_POST['ipt'];


if ($_POST['clear']) {
    $inputtext   = "";
    $output1 = "";
}

if ($_POST['send']) {
    $output1 = "Number of words in this text: " . str_word_count($inputtext);
}
?>
<html>
<head>
<style>
body {
font-family:arial;
font-size:12px
}

.bigtextarea {
width:100%;
height:40%;
min-height:200px
}

textarea {
font-family:monospace;
border-color:#a9a9a9
}
</style>
</head>

<title>Form results on one page after submit</title>
<body>
<form action="" method="POST">
  <h1>Form results on one page after submit</h1>
  <h3>Copy and Paste text:</h3>
  <input class="bigtextarea" wrap="hard" type= textarea name=ipt value="<?php echo $inputtext;?>" height="100px" size="100%">
  <input type="submit" name="send" value="Ok" title="Click here to display values.">
  <input type="submit" name="clear" value="Clear" title="Click here to clear text boxes.">
</form>
<?php
echo "<br><br>";
echo "<font size='4'>";
echo $output1;
echo "</font>";
?>
</body>
</html>
<input class="bigtextarea" wrap="hard" type= textarea name=ipt
value="<?php echo $inputtext;?>" height="100px" size="100%">

替换为

<textarea name="ipt" class="bigtextarea" wrap="hard"><?php echo $inputtext ?></textarea>