我有一张表格
<form action="welcome.php" method="post" ........................">
<button id=......................ERATE NEW ....</button>
<br/><br/>
<div class="form-field">
<label for...............">....... TEST</label>
<br/>
<textarea id=...........................="false"></textarea>
<span class="clipSp............ successfully copied to clipboard" ></span>
<br/>
</div>
<br/>
<div clas..........content">
<div>ADDRESS
<br/>
<span>{{vm.displayAddress}}</span>
</div>
</div>
<button class="wButton fade" type="submit">REGISTER ACCOUNT</button>
<span class="divider-2"></span>
<button class="wButton fade" type="reset" ng-click="vm.back()">BACK</button>
.
.
.
.
然后我有这个“welcome.php”文件。
if(!empty($_POST['formdesiredpost'])){
$var = $_POST['formdesiredpost'];
file_put_contents("data.txt", $var . "\n", FILE_APPEND);
header("Location: https://randomwebsiteredirect.com");
exit();
}
它应该将表格(textarea)中的所需值发布到txt文件data.txt
中,然后重定向到网站。
问题是它只适用于短长度输入。我的意思是aprox (15 characters)
,如果我输入的内容超过15 , like 70,
,它只会重定向到空白welcome.php并且什么都不做。
有关可能发生的事情的任何线索?
答案 0 :(得分:0)
在您的HTML上,您没有&#34; formdesiredpost&#34;领域。请检查是否存在&#34; formdesiredpost&#34;领域。
在您的welcome.php中,在代码的顶部添加错误报告功能:
error_reporting(0);
查看将数据发送到welcome.php后发生了什么
工作正常:
的index.php:
<form action="welcome.php" method="post">
<textarea name="formdesiredpost"></textarea>
<input type="submit" value="submit">
</form>
的welcome.php
<?php
if(!empty($_POST['formdesiredpost'])){
$var = $_POST['formdesiredpost'];
file_put_contents("data.txt", $var . "\n", FILE_APPEND);
header("Location: https://randomwebsiteredirect.com");
exit();
}
?>
请检查字段的字符限制:
Limit number of characters allowed in form input text field