简体   繁体   English

如何访问.php文件中以html格式输入的信息?

[英]How do I access information entered in a form on html on the .php file?

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. echo函数适用于.php文件中的单词,但它只忽略表单信息。 Please could someone tell me where I am going wrong. 请有人告诉我我要去哪里错了。 I am using Google Chrome if that matters. 如果这很重要,我正在使用Google Chrome。 This is the .html file. 这是.html文件。

<!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 这是一个名为welcome.php的.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. 说包含表单的页面名称是index.html。

  • Put both the files in your "www/your_project" folder. 将两个文件都放在“ www / your_project”文件夹中。
  • Type in browser's address bar http://localhost/your_project 在浏览器的地址栏中输入http:// localhost / your_project
  • Provide some input in the form on index.html and hit Submit Query button. index.html上的表单中提供一些输入,然后单击Submit Query按钮。
  • You will see your $_POST data on welcome.php 您将在welcome.php上看到$ _POST数据

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何过滤在html表单中输入的电子邮件? - How do I filter emails entered into a form on html? 如果文件附加到HTML表单,我如何检查PHP? - How do I check with PHP if a file was attached to an HTML form? 我应该使用SSL证书来保护以PHP形式输入的信息吗? - Should i use an SSL Certificate to protect information entered in a PHP form? 如何根据表单中输入的信息进行实时预览? PhP / ajax? - How to make live preview based on information entered in a form? PhP/ajax? 如何让我的PHP脚本验证在HTML表单上输入的内容,以便仅显示在该表单上输入的内容? - How can I have my PHP script validate what was entered on my HTML form so that it will only display what was entered on that form? 如何使用PHP从PDF文件访问元数据信息? - How do I access the metadata information from a PDF file using PHP? 输入到php表格中的信息会一直保留到提交 - Information entered into php form remains there until submitted 输入表格后,如何在html / php文件的后面的变量中访问输入的值? - After input form, how do you access the value that was input, into a variable later in the html/php file? 在 HTML 表单中,如何通过 optgroup 的 PHP 访问 select 标记中的选项? - In a HTML form how can I do to access via PHP a option from select tag by optgroup? 如何从我的 HTML 代码访问 public_html 目录中的 PHP 文件? - How do I access a PHP file in public_html directory from my HTML code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM