Skip to main content
Known Participant
Dec 17, 2017 10:20 PM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
    Nancy OShea
    Nancy OSheaCorrect answer
    Community Expert
    Dec 18, 2017 1:40 AM UTC

    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

    Nancy O'Shea— Product User & Community Expert

    8 replies

    Nancy OShea
    Community Expert
    Community Expert
    Dec 17, 2017 11:42 PM UTC

    You can clear form input fields on submit with JavaScript.

    Translate
    Nancy O'Shea— Product User & Community Expert
    Known Participant
    Dec 18, 2017 12:15 AM UTC

    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>

    Translate
    Nancy OShea
    Community Expert
    Community Expert
    Dec 18, 2017 12:29 AM UTC

    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.

    Translate
    Nancy O'Shea— Product User & Community Expert