Clear the form field after successful submission of php form

后端 未结 12 1724
春和景丽
春和景丽 2020-12-16 06:10

I am making a simple Form the problem i am facing is when i submit the form values still remains in the field. and I want to clear it after SUCCESSFUL submission. Please hel

12条回答
  •  天涯浪人
    2020-12-16 07:00

    I was facing this similiar problem and did not want to use header() to redirect to another page.

    Solution:

    Use $_POST = array(); to reset the $_POST array at the top of the form, along with the code used to process the form.

    The error or success messages can be conditionally added after the form. Hope this helps :)

提交回复
热议问题