How to popup a JavaScript confirmation window before executing:
<form action="index.php" method="get">
<input type="hidden" name="act" value="run">
<input type="submit" value="Clear map">
</form>
<?php
if (!empty($_GET['act'])) {
mysql_query("TRUNCATE TABLE mapinfo");
$page = $_SERVER['PHP_SELF'];
header("Location: $page");
}
?>
User has to press OK to execute PHP or Cancel to not.
1 Answer