Grow your CSS skills. Land your dream job.

php form refresh send form again (prevent)

  • # January 9, 2013 at 6:07 am

    when a form is filled and send, if you refresh the page, its says that the form will send again. (submit the form again).

    What is a good way to prevent this from happening? or kill this session?

    any guidance in this?

    thank you

    # January 9, 2013 at 7:28 am

    Use the PHP script that takes the form data to redirect back to that page.

    # January 13, 2013 at 3:47 am

    do u mean using meta refresh ?

    __
    # January 13, 2013 at 12:56 pm

    No, an HTTP redirect. You can use the [header()](http://php.net/header) function to send http headers with PHP.

    This way, you can get the info from the form, store it (probably in your session), and then redirect to the same page to send your response. Since you never send a body response to the *actual* form submission, the user’s browser won’t store it in its history (and so, can’t submit the form again on refresh/back/etc.).

    # January 25, 2013 at 7:40 am

    @amis traq said right method to prevent your issue

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".