I have added a button to my HTML page so that I may truncate my SQL database table whenever the user needs to.
However every time I refresh the page now the table gets truncated, without me pressing the button.
Anyone know the way around this?
Button submit code:
<form method="post" action="eDBase.php">
<input name="truncate_But" type="submit" value=" Truncate Table " />
</form>
Button truncate code:
if(isset($_POST['truncate_But']))
{
mysqli_query($conn, 'TRUNCATE TABLE `clientinfo`');
header("Location: " . $_SERVER['PHP_SELF']);
exit();
}