如何在.php文件上的html上访问表单中输入的信息?

I have tried plenty of methods already including ones on this site. The echo function works for the words on the .php file but it just ignores the form information. Please could someone tell me where I am going wrong. I am using Google Chrome if that matters. This is the .html file.

<!DOCTYPE HTML>
<html> 
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>

</body>
</html>

and this is the .php file named welcome.php

<html>
<body>

Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>

</body>
</html>

and all it displays after entering information and clicking submit, all it displays is:

Welcome 
Your email address is:

I would be very grateful if anyone can help. Thanks in advance.

Say the page name, containing the form, is index.html.

  • Put both the files in your "www/your_project" folder.
  • Type in browser's address bar http://localhost/your_project
  • Provide some input in the form on index.html and hit Submit Query button.
  • You will see your $_POST data on welcome.php