【发布时间】:2021-05-20 20:56:01
【问题描述】:
我正在尝试从输入框中收集数据,但提交按钮仅适用于一个文本框。有没有简单的方法来解决这个问题?代码:
<?php
if(isset($_POST['textdata']))
{
$data=$_POST['textdata'];
$fp = fopen('data.txt', 'a');
fwrite($fp, $data);
fclose($fp);
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/favicon.ico" />
<title>Yeet!</title>
<style>
html {
background-color: #181818;
}
body {
color: lightgray;
text-align: center;
font-family: monospace;
}
</style>
</head>
<body>
<form method="post">
<br>
<input type="text" name="textdata"><br>
<br>
<input type="text" name="textdata"><br>
<br>
<input type="text" name="textdata"><br>
<br>
<input type="text" name="textdata"><br>
<br>
<input type="text" name="textdata"><br>
<input type="submit" name="submit">
</form>
</body>
</html>
我只是不希望我的所有文本框都有提交按钮。提前致谢!
【问题讨论】:
标签: php html forms button submit