www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] How to Preview then Submit

  1. #1
    Join Date
    Jun 2007
    Posts
    191

    resolved [RESOLVED] How to Preview then Submit

    I am wanting for the user to be able to preview, and edit, before they submit a form to process. Any suggestions.

  2. #2
    Join Date
    Jun 2006
    Location
    Down at the bottom of the garden
    Posts
    1,239
    page1.php
    PHP Code:
    <form action="page2.php" method="post">
    Name : <input name="name">
    <
    input type="submit" value="GO">
    </
    form
    page2.php
    PHP Code:
    <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
    PHP Code:
    var_dump($_POST); 

  3. #3
    Join Date
    Jun 2007
    Posts
    191

    Thanks

    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.

  4. #4
    Join Date
    Jun 2007
    Posts
    191
    I guess I should post what I did.

    form.html
    HTML Code:
    <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.

    HTML Code:
    <form method="post" action="submit.php">
    PHP Code:
    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

    PHP Code:
    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.
    Last edited by monarch_684; 06-25-2007 at 12:16 PM.

  5. #5
    Join Date
    Jun 2006
    Location
    Down at the bottom of the garden
    Posts
    1,239
    Sorry, it should of been..

    PHP Code:
    <?php
    var_dump
    ($_POST);
    ?>
    Good job

    Glad I could help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles