HTML PHP表单帖子显示空白?

I have two files, testpage.html and testpage.php in the same folder.

This is testpage.html

<!DOCTYPE HTML>
<html>
<body>

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

</body>
</html>

This is testpage.php

<html> 
<body>

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

</body>
</html>

The form seems to work okay but when I hit submit nothing shows up on the next page. no matter what I enter int he form, it always reads "Welcome" "Your email address is:" with nothing entered after that like its supposed to.

Do I have something configured incorrectly? Am I using the wrong browser (firefox)?

Thanks!

"I am accessing it via file:///C:/... should I be accessing it some other way instead?"

  • Just as I thought.

There you go. A web browser will not parse PHP directives that way.

It must be accessed as http://localhost/yourfile.xxx

Plus, a webserver and PHP need to be installed in order to parse PHP directives.

"I don't think I have Xampp or any virtual server set up... I'll look into that, any tips on where to start?"

You need to install one. Here are a few links to get you started and depending on the platform you are using.

Pick your flavour.