Anúncios
After inserting it to database, call unset() method to clear the data. unset($_POST); To prevent refresh data insertion, do a page redirection to same page or different page after record insert.One way to stop page resubmission on page refresh is to unset the form data after it is submitted so that the variable storing form data becomes empty and wrap up your form processing block of codes to check if the form is empty. if (!empty ($_POST) && $_SERVER [‘REQUEST_METHOD’] == ‘POST’) { $data = // processing codes here unset $data; }
How do I stop form submit from refresh in PHP?
After inserting it to database, call unset() method to clear the data. unset($_POST); To prevent refresh data insertion, do a page redirection to same page or different page after record insert.
Anúncios
How do I stop form submit from refreshing?
Use the preventDefault() method on the event object to prevent a page refresh on form submit in React, e.g. event. preventDefault() . The preventDefault method prevents the browser from issuing the default action which in the case of a form submission is to refresh the page.
How do I stop form submitting?
The simplest solution to prevent the form submission is to return false on submit event handler defined using the onsubmit property in the HTML
Anúncios