Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Orr is offline
    New to the CF scene
    Join Date
    Sep 2006
    Thanked 0 Times in 0 Posts

    Unhappy User entered data disappears on goback

    I have a simple HTML form for my visitors to fill out some input fields. This information gets validated by a php function that either 1. accepts the data and emails it to me OR 2. tells the client that there is something wrong with his data entry that he needs to correct (one or more obligatory fields missing; no @ in the email name; etc.) and sends the client back like this

    echo "<FORM method=\"POST\" name=\"GoBack\">\n";
    echo "<p style=\"style5\">Please enter a valid email address.<\p>\n";
    echo "<p><INPUT TYPE=\"button\" NAME=\"GoBack\" VALUE=\"Back\" OnClick=\"javascript:window.history.back(1)\">\n";
    echo "</FORM>\n";

    but the data that the client has entered disappears.
    My question: How do I make sure (as much as possible) that the client does not have to re-enter all the fields again?

    Thank you for anyone who can help me on this issue!

  • #2
    New Coder
    Join Date
    Aug 2006
    Thanked 1 Time in 1 Post
    after validation you just put the variables in the value field of the form before sending the html. So in your example that should be easy.


    if you initialise the form variables to "" on a GET and always do as above, then there is no difference to code between a get and a post except deciding whether its a get or a post and performing the relevant code before formatting the form output.


    Posting Permissions

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