I'm trying to collect data from input boxes but the submit button only works for one text box. Is there a simple way to fix this? Code:
<?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>
I just don't want all of my text boxes to have a submit button. Thanks in advance!