【发布时间】:2021-12-20 06:33:12
【问题描述】:
如何在我的简单表单中添加更多字段 我的意思是我想添加用户名、电子邮件、主题、主题 2、subjet 3 .. 只是表单中的更多字段,仅此而已
<!DOCTYPE html>
<html>
<head>
<title>Store form data in .txt file</title>
</head>
<body>
<form method="post">
Enter Your Text Here:<br>
<input type="text" name="textdata"><br>
<input type="submit" name="submit">
</form>
</body>
</html>
<?php
if(isset($_POST['textdata']))
{
$data=$_POST['textdata'];
$fp = fopen('data.txt', 'a');
fwrite($fp, $data, $data2);
fclose($fp);
}
?>
【问题讨论】:
-
<input type="text" name="username">... ?? <input>: The Input (Form Input) element -
如何在 php 代码中添加它
-
$username = $_POST['username'];
-
多学一点,学得更快。
-
PHP 手册在Dealing with Forms 上有一个简单的教程,我建议你先阅读它,也许先阅读另一个表单教程