Click to See Complete Forum and Search --> : [RESOLVED] How to Preview then Submit


monarch_684
06-25-2007, 10:57 AM
I am wanting for the user to be able to preview, and edit, before they submit a form to process. Any suggestions.

MrCoder
06-25-2007, 11:03 AM
page1.php

<form action="page2.php" method="post">
Name : <input name="name">
<input type="submit" value="GO">
</form>


page2.php

<form action="page3.php" method="post">
<input type="hidden" name="name" value="<?php echo $_POST["name"]; ?>">
Name : <?php echo $_POST["name"]; ?>
<br>
<input type="submit" value="Confirm">
</form>


page3.php

var_dump($_POST);

monarch_684
06-25-2007, 11:37 AM
Thanks for the help even though

var_dump($_POST);

did not work, but I used your

<input type="hidden" name="name" value="<?php echo $_POST["name"]; ?>">

and saw what needed to be done to do what I wanted to do.

Thanks Again.

monarch_684
06-25-2007, 12:13 PM
I guess I should post what I did.

form.html

<form method="POST" action="preview.php">
<p>Employee Name: <input type="text" name="name" /></p>

<p>Requesting PTO for <input type="text" name="hours" />hour(s) for the date of <input type="text" name="date" /></p>
<p>Requesting PTO from (beginning)<input type="text" name="beginDate" /> to (end) <input type="text" name="endDate" /></p>
<p>Submitted By<input type="text" name="signature" /> Supervisor
<select name="supervisor">
<option name="supervisor" value="email">John Doe</option>
<option name="supervisor" value="email">Jane Doe</option>
</select></p>
<input type="submit" value="Submit"><input type="reset" value="Reset">



preview.php

This is also a form so that you can submit it.


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



echo "<p>Employee Name: <b>" .$_POST["name"]. "</b></p>";
echo "<p>Requesting PTO for<b> " .$_POST["hours"]. " </b>hour(s) for the date of<b> " .$_POST["date"]. " </b></p>";
echo "<p>or</p>";
echo "<p>Requesting PTO from (beginning)<b> ".$_POST["beginDate"]." </b>to (end)<b> ".$_POST["endDate"]." </b></p>";
echo "<p>Submitted By:<b> ".$_POST["signature"]." </b></p>";
echo "<p>Supervisor:<b> ".$_POST["supervisor"]." </b></p>";
echo "<p><input type='button' value='Print' class='hidden' onclick='window.print();return false;' />";
echo "<input type='button' value='Edit Form' class='hidden' onClick='history.go(-1)' />";
echo "<input type='submit' value='Submit' /></p>";
echo "<input type='hidden' name='name' value='".$_POST["name"]."' />";
echo "<input type='hidden' name='hours' value='".$_POST["hours"]."' />";
echo "<input type='hidden' name='date' value='".$_POST["date"]."' />";
echo "<input type='hidden' name='beginDate' value='".$_POST["beginDate"]."' />";
echo "<input type='hidden' name='endDate' value='".$_POST["endDate"]."' />";
echo "<input type='hidden' name='signature' value='".$_POST["signature"]."' />";
echo "<input type='hidden' name='supervisor' value='".$_POST["supervisor"]."' />";


submit.php


echo "<p>Your PTO Request has been submitted</p>";
echo "<p>You will now be redirected to the Intranet in 5 seconds</p>";

$msg = "PTO Request \n";
$msg .= "Name: ".$_POST["name"]. "\n";
$msg .= "How many hours: ".$_POST["hours"]. " hours on ".$_POST["date"]."\n";
$msg .= "What days: ".$_POST["beginDate"]. " - ".$_POST["endDate"]. "\n";
$msg .= "Signature: ".$_POST["signature"]. "\n";
$msg .= "Delete below lines before forwarding!!! \n"


$to = "".$_POST["supervisor"];
$subject = "PTO Request from ".$_POST["name"];
$mailheader = "From: PTO_Request";

mail($to, $subject, $msg, $mailheader);


This works great.

I am using this to also send to user selected email.

MrCoder
06-25-2007, 12:55 PM
Sorry, it should of been..


<?php
var_dump($_POST);
?>


Good job :)

Glad I could help