<?php
/* ... SQL EXECUTION TO UPDATE DB ... */
?>
<form method = "post"
action = "<?=$_SERVER['php_self']?>"
onSubmit= "window.close();">
...
<input type="submit" value="submit" />
<input type="reset" value="reset" />
</form>
I would like to close page after submitting the form. After running the above code the page is closed after clicking submit button, but the SQL doesn't execute.
Can anyone help me?
<?php
/* ... SQL EXECUTION TO UPDATE DB ... */
echo "<script>window.close();</script>";
?>
and Remove the window.close()
from the form onsubmit
event
Remove onsubmit
from the form
tag. Change this:
<input type="submit" value="submit" />
To:
<input type="submit" value="submit" name='btnSub' />
And write this:
if(isset($_POST['btnSub']))
echo "<script>window.close();</script>";
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