Save a "print screen" of the page before submiting the form

Discussion in 'PHP' started by Fracisc, Jan 6, 2010.

  1. #1
    I have a page with a form on it. What I need to do is to save the page before sending out the form.

    So, the visitor completes the form and press the send button. When this happens I need to see how the form looks at that point. I know I can send the result to e-mail but there are to many fields to edit to do this, so I am wondering if I can just save the page as it is.

    Any idea?
     
    Fracisc, Jan 6, 2010 IP
  2. Bananasphere

    Bananasphere Peon

    Messages:
    76
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You're saying you literally want a screenshot of the form?

    Why not just save the information to a database and recreate the fields by pulling the information? I'll do that for you if you post your code.

    - BS
     
    Bananasphere, Jan 6, 2010 IP
  3. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #3
    I guess you wanted to say that the code would need many changes?
    Well, taking a screenshot and then posting it back to your server would need some heavy Javascript and client's bandwidth, and it wouldn't work on IE (correct me if I'm wrong - nothing works on IE). But you could mail() or fwrite() it with ease, generating a picture with GD2 and mailing or saving it wouldn't be that hard either.
     
    iAreCow, Jan 6, 2010 IP
  4. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As far as I know you can't printscreen with javascript, and you couldn't then send it to your script either since you'd need to save it, then reference the file with a file input and then send the form. It's just not gonna happen. Javascript doesn't have this kind of access, and PHP definitely won't be accessing the computer to do it
     
    JAY6390, Jan 6, 2010 IP
  5. Bananasphere

    Bananasphere Peon

    Messages:
    76
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Can you go into detail and say what this form does, where the data is stored, etc? A very simple modification to the code could allow you to view the code precisely as it was submitted without needing to do something as ridiculous as a screenshot.

    -BS
     
    Bananasphere, Jan 6, 2010 IP
  6. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #6
    In case you want mail();
    
    <form method="POST">
    <input name="name" size="25" />
    <input name="age" size="10" maxlength="2" />
    <textarea name="bio" cols="50" rows="10"></textarea>
    <input name="submit" type="submit" />
    </form>
    <?php
    if(!isset($_POST["submit"]))die(); // IF nothing is POSTed, kill the script without error message
    // Define variables
    $name = $_POST["name"];
    $age = $_POST["age"];
    $bio = $_POST["bio"];
    if(mail("you@linuxmail.com",$name." sent you their biography",$bio)) echo "Mail sent"; // mail(email,subject,content) - IF mail is sent, echo success message, otherwise show some error
    ?>
    
    PHP:
     
    iAreCow, Jan 6, 2010 IP