I have a PHP POST Script setup and after you post the script it refers to its own page. This script is more like an Insert and Update at the same time. Two different things going on. Everything works, however, when I refresh the page again, it duplicates the information and inserts it again in the Table.
Here is part of the script:
<?php
/* Calculator */
$thedate = date("m/d/y");
$filenumber = mysqli_real_escape_string($dbc, trim($_POST['filenumber']));
$numb = mysqli_real_escape_string($dbc, trim($_POST['numb']));
$claimbalancedue1 = $numa-$numb;
if($submit)
{
if($operator == '-')
{
$query = "UPDATE casesubmission SET claimbalancedue = '$claimbalancedue1' WHERE filenumber = '$filenumber'";
mysqli_query($dbc, $query);
$query2 = "INSERT INTO casetransactions (filenumber, thedate, numb, claimbalancedue1) VALUES ('$filenumber', '$thedate', '$numb', '$claimbalancedue1')";
mysqli_query($dbc, $query2);
}
}
?>
What can I do to this script to stop it from posting twice? It should be simple but I can't think of a way.
Here is part of the script:
<?php
/* Calculator */
$thedate = date("m/d/y");
$filenumber = mysqli_real_escape_string($dbc, trim($_POST['filenumber']));
$numb = mysqli_real_escape_string($dbc, trim($_POST['numb']));
$claimbalancedue1 = $numa-$numb;
if($submit)
{
if($operator == '-')
{
$query = "UPDATE casesubmission SET claimbalancedue = '$claimbalancedue1' WHERE filenumber = '$filenumber'";
mysqli_query($dbc, $query);
$query2 = "INSERT INTO casetransactions (filenumber, thedate, numb, claimbalancedue1) VALUES ('$filenumber', '$thedate', '$numb', '$claimbalancedue1')";
mysqli_query($dbc, $query2);
}
}
?>
What can I do to this script to stop it from posting twice? It should be simple but I can't think of a way.