I have a little problem. I want to reload my page after submitting a form.
<form method="post" action=""> <textarea cols="30" rows="4" name="update" id="update" maxlength="200" ></textarea> <br /> <input type="submit" value=" Update " id="update_button" class="update_button"/> </form>
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 you stay in the same page after submit a form in HTML? In order to stay on the same page on submit you can leave action empty ( action=”” ) into the form tag, or leave it out altogether. For the message, create a variable ( $message = “Success! You entered: “.
Use header() function to refresh a web page in PHP. The HTTP functions are those functions which manipulate information sent to the client or browser by the Web server before any other output has been sent. The PHP header() function sends an HTTP header to a client or browser in raw form.
only use
echo "<meta http-equiv='refresh' content='0'>";
right after insert query before } example
if(isset($_POST['submit'])) { SQL QUERY---- echo "<meta http-equiv='refresh' content='0'>"; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With