我有一份表格
<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,什么也不做。
有可能发生什么事吗?
发布于 2017-07-15 09:55:22
在html中,您没有"formdesiredpost“字段。请检查是否存在"formdesiredpost“字段。
在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();
}
?>请检查字段的字符限制:
https://stackoverflow.com/questions/45116672
复制相似问题