这是我的代码
<?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的页面,在那里你可以看到隐藏的字段,然后在它的联系表单下面。
现在我希望当用户提交表单然后发送电子邮件发送(工作正常),然后页面重定向到其他网站并获取隐藏字段的值,我想知道它将如何完成。