形式文本方面而不是输入



我得到了此代码,我想对其进行一些修改。这是一种显示文本中单词数量的形式。我想更改输入(

我尝试了很多事情来使用文本方面,但是没有输出,或者原始文本消失了。将名称更改为ID不起作用,对于"使用Textarea的普通方式"也是如此。

是否有一种方法可以用Textarea代替输入?必须留下来的一件事是,在提交文本文本之后,需要可见。

我感谢任何帮助。

<?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>

最新更新