我正在尝试使用我的脚本
- 接收建议
- 使用精确到秒的日期和时间命名的建议创建文件
发生的问题是文件已创建,但不包含任何数据。
"网页"按钮
<form action="suggestions.php" action="POST">
Suggest some content for this page: <input type="text" name="suggestion"></br>
</br>
<input type="submit">
</form>
.PHP
<?php
$filename = date('Format String');
$Content = $_POST["suggestion"];
file_put_contents('./suggestions/'.$filename, $Content);
?>
你有两次操作属性
<form action="suggestions.php" action="POST">
你肯定是指方法属性:
<form action="suggestions.php" method="POST">
这将导致表单作为GET
发送,并且您的 POST 变量为空
在您的
HTML form
中您犯了一个拼写错误
<form action="suggestions.php" action="POST">
您需要在此处将action
更改为method
:
<form action="suggestions.php" method="POST">