dongmiyu8979 2017-12-09 23:01
浏览 36
已采纳

从HTML表单到PHP的数据[重复]

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>
  • 写回答

2条回答 默认 最新

  • dotelauv682684 2017-12-09 23:04
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?