从HTML表单到PHP的数据[重复]
This question already has an answer here:
i have my HTML file:
<form action="input_db.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
and PHP file in the same directory:
Welcome <?php echo $_GET["name"]; ?><br>
Your email address is: <?php echo $_GET["email"]; ?>
Both running on a "UniServer Zero XIII" on my local windwos maschine
the problem is that the echo just not work
https://www.w3schools.com/php/php_forms.asp its this example from w3schools
</div>
此问题已经存在 这里有一个答案: p>
-
”注意:未定义的变量“,”注意:未定义的索引“和”通知:未定义的偏移“使用PHP
28 answers
span>
li>
ul>
div>
我有我的HTML文件: p>
&lt; form action =“input_db.php”method =“post”&gt; Name:&lt; input type =“text”name =“name”&gt;&lt; br&gt; E-mail:&lt; input type =“text”name =“email”&gt;&lt; br&gt; &lt; input type =“submit”&gt; &lt; / form&gt ; code> pre>
和PHP文件在同一目录中: p>
欢迎&lt;?php echo $ _GET [“ 名称”]; ?&gt;&lt; br&gt; 您的电子邮件地址是:&lt;?php echo $ _GET [“email”]; ?&gt; code> pre>
在本地windwos机器上的“UniServer Zero XIII”上运行 p>
问题是 回声不起作用 p>
https://www.w3schools .com / php / php_forms.asp 来自w3schools的这个例子 p> div>
You sending the data in form with the "POST" method and you trying to get it with $_GET variable;
you can edit the form method to "get" :
<form action="input_db.php" method="get">
Or try to get the data with the $_POST["name"] variable
You set the method to POST in the form.
So you need to use POST["name"]
instead of GET["name"]
in your PHP