0

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

Steffen Bauer
  • 145
  • 1
  • 10

2 Answers2

1

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

FAROUK BLALOU
  • 698
  • 1
  • 10
  • 19
0

You set the method to POST in the form.
So you need to use POST["name"] instead of GET["name"] in your PHP

2pha
  • 9,798
  • 2
  • 29
  • 43