PHP邮件scripr确认 [英] PHP mail scripr confirmation

查看:87
本文介绍了PHP邮件scripr确认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML文件,其中包含一些文本输入字段单选按钮 select盒。当用户提交完成的表单时,使用 POST 并将这些数据发送到邮件脚本,然后发送所需的电子邮件。

I have a html filee with some text input fields , radio buttons and select boxes. When a user submit the completed form It use POST and send these data to a mail script and then send the required email.

但是现在我想在我的主要html文件和邮件脚本之间添加一个确认页面。用户必须能够看到他们输入的数据,并且会有两个按钮和后退按钮。我们搜索了很多解决方案,但找不到一个很好的解决方案。

But now I want to add a confirmation page in between my main html file and mail script. Users have to be able to see the data they entered and there would be two buttons called proceed and back. Proceed will send the mail and back would take the user back to the html file.

我如何使用php来做到这一点。这里的问题是我可以将数据存入确认页面,但如果用户点击继续,则无法将其发送到邮件脚本。

I have searched for many solutions, but couldn't find a good solution. How can I do this using php. The problem here is I can get the data to the confirmation page, but then can't send it to the mail script if user click proceed.

推荐答案

这可能有助于

file.php

<form action="preview.php" method="post">

    <input type="text" name="email">
    <input type="text" name="subject">
    <textarea name="message"></textarea>

    <input type="submit" value="Continue">
</form>

文件preview.php

file preview.php

<form action="send.php" method="post">

    <input type="hidden" name="email" value="<?php echo $_POST['email'];?>">
    <input type="hidden" name="subject" value="<?php echo $_POST['subject'];?>">
    <input type="hidden" name="message" value="<?php echo $_POST['message'];?>">
    Email: <?php echo $_POST['email'];?>
    <br/>
    Subject: <?php echo $_POST['subject'];?>
    <br/>
    Message: <?php echo $_POST['message'];?>

    <input type="submit" value="Send">
    <a href="message.php" title="Back">Back</a>   
</form>

文件send.php

file send.php

<?php
if(isset($_POST['email'])){

    mail($_POST['email'],$_POST['subject'],$_POST['message'];
    echo 'Message sent successfully';     
}else{
    header('Location: message.php');
}
?>

这篇关于PHP邮件scripr确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆