(PHP) Is handling a form submission on the same page more/less/equally good as handling on a separate page?

后端 未结 3 1920
耶瑟儿~
耶瑟儿~ 2021-01-13 20:23

I have a PHP form, and I\'m wondering how I should handle submission. I remember when learning Rails that the behavior was to have a special handler page for a form, which t

3条回答
  •  执笔经年
    2021-01-13 21:13

    Post-Redirect-Get is the design pattern recommended for web-forms to prevent resubmission (and what you used in rails)

    It doesn't really matter if you submit to the same page or a different one, it's the redirect which prevents the accidental resubmission. You can therefore choose whether to post to the same page or a separate page depending on your coding style and/or application semantics.

提交回复
热议问题