Php 从html页面和弹出窗口捕获信息

Php 从html页面和弹出窗口捕获信息,php,html,Php,Html,我有一个带有文本文件的html页面,还有一个打开弹出窗口的操作按钮,如本例所示 http://www.andwecode.com/playground-demo/pop-up-login-signup-box-jquery/#modal (点击登录查看弹出窗口)谁也有两个文本字段,我如何收集在3个框中输入的文本(页面中的一个和弹出窗口中的两个),同时使用php文件?因为我需要把它们都发到我的邮箱 我的php文件的一个示例: <?php $txt1 = "textfield 1 : ".$_

我有一个带有文本文件的html页面,还有一个打开弹出窗口的操作按钮,如本例所示

http://www.andwecode.com/playground-demo/pop-up-login-signup-box-jquery/#modal

(点击登录查看弹出窗口)谁也有两个文本字段,我如何收集在3个框中输入的文本(页面中的一个和弹出窗口中的两个),同时使用php文件?因为我需要把它们都发到我的邮箱 我的php文件的一个示例:

<?php
$txt1 = "textfield 1 : ".$_POST['textfield1'];
$txt2= "textfield 2 : ".$_POST['textfield2'];
$tx3= "textfield 3 : ".$_POST['textfield3'];
$message = "
$txt1
$txt2
$txt3
";
$to = "myemail@example.com";  
$subject = "data :".$txt1;
$headers = "From: <myemail@example.com>";
$headers = "MIME-Version: 1.0\n";
$from = "example";
mail($to,$subject,$message,$headers,$from);
} 
?>


如果想知道如何从

中收集所有文本,PHP要在一篇文章中接收三个不同输入的值,所有三个输入都需要包含在同一个HTML
中。尝试移动HTML,使所有输入都包含在一个表单中,然后PHP应该可以在
$\u POST
数组中访问所有输入。

在我看来,输入标记上没有“name”属性,请尝试类似的操作

 <!--ALL THE HTML-->
Email: <input type="text" name="email"></input>
Password: <input type="pass" name="pass"></input>
<!--MORE HTML-->

电邮:
密码:
单独的PHP文件

 <?php
      function getdata(){
        $email= $_GET['email']; //Email
        $pass= $_GET['pass']; //Password
        $name = $_GET['name']; //Full name (Only will apply if registering)
                };//This gets the data and gives it a variable
          //Then more php like you had already to email to yourself
    ?>

简单来说,将“name”属性添加到输入(
name=“whatevername”
),然后在php中使用
$\u GET
来获取数据(
$varname=$\u GET['nameattributehere'];

记住

  • 将PHP代码放在扩展名为.PHP的单独文件中(.HTML不起作用!)
  • 将“名称”属性添加到输入中
  • 标签上,您必须添加此项
    method=“get”action=“srcfortheppfile.php”
  • 祝你好运