• Leo

    (@wp_new_user)


    Hi all,

    I have a custom post type – holiday, and holidays have custom fields: date, destination, type, etc.
    I have a loop listing all my holidays and a form to filter the loop by the custom fields.
    The form has 4 select boxes and for each selected value I filter the query by meta_value.
    Everything works fine.

    But when a user reloads the filtered loop page or navigates away and clicks the browser ‘back’ button it asks for a confirmation of post submission, because I use POST.

    I don’t mind the form to be resubmitted, as I don’t store any data or anything, I just filter the loop, so I just want to prevent the confirmation.

    I can use GET instead and this won’t happen, but then my URLs have the get parameters (4 parameters with their values) – and obviously I would like a URL without any parameters.

    Is there another way to do it or should I use get?

    Any advice?

    Thank you.
    Leo

Viewing 2 replies - 1 through 2 (of 2 total)
  • First, the submit action should redirect the user to a new url. That URL should contain specific conditional logic that checks how you got to that url and only when appropriate redirects you to the final result, or on issue, back you go. When at results OK page and a user clicks the back button, the intermediate url checks that (and sends you somewhere else entirely).

    Happy coding!

    Thread Starter Leo

    (@wp_new_user)

    Thanks, got it.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to prevent form resubmission confirmation?’ is closed to new replies.