Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 发送邮件然后传递表单的值?_Php_Forms_Email - Fatal编程技术网

Php 发送邮件然后传递表单的值?

Php 发送邮件然后传递表单的值?,php,forms,email,Php,Forms,Email,这是我的密码 <?php ob_start(); $x_login = $_POST['x_login']; $x_amount = $_POST['x_amount']; $x_show_form = $_POST['x_show']; if(isset($_POST['submit'])){ $to = "abcd@gmail.com"; // this is your Email address $from = $_POST['email']

这是我的密码

    <?php
ob_start();
  $x_login = $_POST['x_login'];
  $x_amount = $_POST['x_amount'];
  $x_show_form = $_POST['x_show'];

  if(isset($_POST['submit'])){
    $to = "abcd@gmail.com"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $first_name = $_POST['fname'];
    $last_name = $_POST['lname'];
    $subject = "Form submission";
    $subject2 = "Copy of your form submission";
    $message = $first_name . " " . $last_name . " wrote the following:" . "\n\n" . $_POST['message'];
    $message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    header("Location: www.example.com");
    exit();
    }


?>
<html>
<body>
                            <form action="" class="contactForm" name="cform" method="post">
                                            <input name="x_login" value="<?php echo $x_login ?>" type="hidden"> 

                                            <input name="x_amount" value="<?php echo $x_amount ?>" type="hidden"> 

                                            <input name="x_show" value="<?php echo $x_show ?>" type="hidden"> 

                                    <div style="width:55%; margin:0 auto;" class="col-md-4">
                                        <label for="fname">First Name<span class="required">*</span></label>
                                        <span class="name-missing">Please enter your First Name</span>  
                                        <input id="fname" name="fname" type="text" value="" size="30">
                                    </div>
                                    <div style="width:55%; margin:0 auto;" class="col-md-4">
                                        <label for="lname">Last Name<span class="required">*</span></label>
                                        <span class="name-missing">Please enter your Last Name</span>  
                                        <input id="lname" name="lname" type="text" value="" size="30">
                                    </div>
                                    <div style="width:55%; margin:0 auto;" class="col-md-4">
                                        <label for="e-mail">Email<span class="required">*</span></label>
                                        <span class="email-missing">Please enter a valid e-mail</span> 
                                        <input id="e-mail" name="email" type="text" value="" size="30">
                                    </div>
                                    <input type="submit" name="submit" value="Submit">   
                            </form>

</body>
</html>
这是一个我用来发送电子邮件的页面,同时也从以前的表单中接收x_login、x_amount、x_show的值,然后转到contactForm,在那里你可以看到隐藏的字段,然后在下面是一个contactForm


现在,我希望当用户提交表单,然后发送电子邮件,然后页面重定向到其他网站,并获取隐藏字段的值,我想知道如何操作。

您可以将其存储在临时cookie/会话中,然后从那里检索它。我不能,因为我没有访问的检索文件www.example.com如果我做对了,那么这个人提交了这个表单,然后你希望它通过电子邮件发送到其他网站,然后将数据转发到其他网站?如果你没有访问页面的权限,你可能不应该将页面中的值传递给它。我想您还可以查看如何从PHP将参数发布到外部页面。@Rasclatt-hmmm对