我正在尝试制作一个注册表单,用户将其姓名输入到时间段。然后名称将保存到文本文件中,但不会保存到文本文件中。
HTML表单派对
<form action="writeit.php" method="POST" name="nameform">
<table style="width:20%">
<tr>
<th>Time</th>
<th colspan="2">Name</th>
</tr>
<tr>
<td>8:00am</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>9:00am</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>10:00am</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>11:00am</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>12:00pm</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>1:00pm</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>2:00pm</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>3:00pm</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>4:00pm</td>
<td><input type="text" name="name" id="name"></td>
</tr>
<tr>
<td>5:00pm</td>
<td><input type="text" name="name" id="name"></td>
</tr>
</table>
<br></br>
<input type="submit" name="submit" value="Save">
</form>
writeit.php文件
<?php
$names = $_POST['name'];
$filename = "signup.txt";
$file = fopen($filename, "a");
fwrite($file, $names);
fclose($file);
?>