Solved

Form mail Preview before submit ?

Posted on 2003-12-03
2
443 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 155 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now