Skip to main content
Known Participant
December 17, 2017
Answered

PHP Form Mail retains filled page after sending, behind the "Thank You" page...

  • December 17, 2017
  • 1 reply
  • 1116 views

PHP Form Mail, on complete and send, opens the "Message Sent" Thank You page, but when click/swipe back, has also retained the just sent form, fully completed, requiring one to also click/swipe back though two pages to return to main site.

Note: This isn't a problem with receiving multiple mail receipts, but of clearing the initial form on receiving the completion notification page.

Mail delivery works as expected. (The following contact page accessed through the nav menu, not directly.

satgraphics.com  select "contact"

    This topic has been closed for replies.
    Correct answer Nancy OShea

    Yes, it's true that the field clears; However, if you then try to return to the page from which the visitor came from, there will be behind the fully filled out form... just as it was when the submit button was clicked.

    Note content of initial query:

    PHP Form Mail, on complete and send, opens the "Message Sent" Thank You page, but when click/swipe back, has also retained the just sent form, fully completed, requiring one to also click/swipe back though two pages to return to main site.

    In this case, the Thank you message is on the same page as your form.  It's not separate.  If you want a separate success/error page, you'll need to use a different script.

    I'm not sure why people would hit the BACK button after submitting a form.  Most people would close it.

    Nancy

    1 reply

    Nancy OShea
    Community Expert
    Community Expert
    December 17, 2017

    You can clear form input fields on submit with JavaScript.

    Nancy O'Shea— Product User & Community Expert
    Known Participant
    December 18, 2017

    Nancy,

    I set an ID and inserted js, but still getting same results.

    Inserted at end of form... </form>

        <script>

    function myFunction() {

        document.getElementById("SatForm").reset();

    }

    </script>

    Nancy OShea
    Community Expert
    Community Expert
    December 18, 2017

    Are you using PHP echo on the input field values?

    value="<?php echo $name; ?>"

    If yes, you can remove that string and leave it empty.

    value=" "

    The only downside is if the form doesn't submit for some reason, the user will have to re-enter their form data.

    Nancy O'Shea— Product User & Community Expert