Solved

Form mail Preview before submit ?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
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 look for a specific file type in a local or remote server directory using PHP.

861 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

24 Experts available now in Live!

Get 1:1 Help Now