When button pressed:
<form action="index.php" method="get">
<input type="hidden" name="act" value="run">
<input type="submit" value="Truncate map">
</form>
if (!empty($_GET['act'])) {
mysql_query("TRUNCATE TABLE mapinfo");
}
It redirects me to index.php?act=run
I want to get rid of it so added: header("Refresh: 0; url=$page");:
if (!empty($_GET['act'])) {
mysql_query("TRUNCATE TABLE mapinfo");
$page = $_SERVER['PHP_SELF'];
header("Refresh: 0; url=$page");
}
but it first loads index.php?act=run than redirecting browser to index.php which makes 2 page refreshes.
How to do it the nice way?
instead of using a refresh header, use
header("Location: $page");