我的任务是将表单数据保存到文本文件中。但是,php 没有被执行。即使在点击提交按钮后,文本文件也是空的。请让我知道 myhtml 的缺陷
<form id="form" name="form" method="post" action="Input2.php">
<label>Choose my Map set :
</label>
<select name="Mapset">
<option value="Global network">Global Network</option>
</select> <br>
<br>
<label>Tiff code:
</label>
<select name="Tiff">
<option value="MX">MX</option>
</select> <br> <br>
<label>Physical size :
</label>
<input type="text" name="size" size="10"><br>
<label>time:
</label>
<input type="text" name="time" size="10"><br>
<div style="text-align: center"><br>
<input type="submit" name="submit" id="submit" value="Next" class="submit">
<div class="spacer"></div>
</form>
我的PHP:
if (isset($_POST['submit'])) {
$data = $_POST['size'];
$data = $_POST['time'];
$file = "input.txt";
$fp = fopen($file, "a") or die("Couldn't open $file for writing!");
fwrite($fp, $data) or die("Couldn't write values to file!");
fclose($fp);
echo "Saved to $file successfully!";
}
header("location:NetOptInput3.html");