Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Form mail Preview before submit ?

Posted on 2003-12-03
2
Medium Priority
?
469 Views
Last Modified: 2008-03-17
Hi all,

I have a form that gets inputs from the user and when hit submit, it sends 2 emails off.
Problem is, how can i do a preview of both emails before they are sent off?
When previewing, how can i go back to edit? and then preview and submit ?

Source here:
http://els.f2o.org/form.txt


Thanks
0
Comment
Question by:rnobius
  • 2
2 Comments
 
LVL 2

Expert Comment

by:nsanden
ID: 9872991
Did you write this script yourself? If so you should know all you need to do is echo the form input on your page instead of mailing it when they hit the preview button.

Example:

<?php

if($_POST['action']=="mail") {

//Mail the form off
mail("firstemail,secondemail","subject","body");

} elseif($_POST['action']=="preview") {

//Don't mail it. Just print the stuff on the screen to preview it.
echo "something: " . $_POST['something'];
echo "somethingelse: " . $_POST['somethingelse'];
echo "<a href=javascript:history.back(-1)>back</a>";

}

?>

<form action=page.php method=POST>
<input name=something type=text>
<input name=somethingelse type=text>
<input name=action value=mail type=submit>
<input name=action value=preview type=submit >
</form>
0
 
LVL 2

Accepted Solution

by:
nsanden earned 620 total points
ID: 9873064
oops, slight modification...

<?php

if($_POST['action']=="mail") {

//Mail the form off
mail("firstemail,secondemail","subject","body");

} elseif($_POST['action']=="preview") {

//Don't mail it. Just print the stuff on the screen to preview it.
echo "something: " . $_POST['something'];
echo "somethingelse: " . $_POST['somethingelse'];
echo "<a href=javascript:history.back(-1)>back</a>";

} else {

?>

<form action=page.php method=POST>
<input name=something type=text>
<input name=somethingelse type=text>
<input name=action value=mail type=submit>
<input name=action value=preview type=submit >
</form>

<?php } ?>
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question