douyi5157 2016-04-09 21:02
浏览 34

如何在.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.

  • 写回答

1条回答 默认 最新

  • dongshu7162 2016-04-09 21:27
    关注

    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
    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)