duanji1924 2016-01-12 18:48
浏览 17
已采纳

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!

  • 写回答

1条回答 默认 最新

  • drsl90685154 2016-01-12 18:57
    关注

    "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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 如何将下列的“无限压缩存储器”设计出来
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口