Refresh on submit behaving weirdly

I would expect that the below code would cause the page to refresh when I pressed submit but it does not appear to be doing so. Can anyone offer some thoughts on why it’s not refreshing when I click submit once but if I click it a few times it will refresh but more importantly I need to force the whole page to refresh whenever the submit button is clicked. I’m open to JS solutions as well but the quirky behavior is making it hard to figure out what’s going on. Thanks for the help!

echo" 
<form action='".$_SERVER['PHP_SELF']."' method='post'>
<input type='hidden' id='ID' name='ID' value='{$row['ID']}' />
<input type='submit' name='formEmailAttempt' id='formEmailAttempt' value='Emailed' />
</form>
{$row['EmailAttempt']}";


if(isset($_POST['formEmailAttempt']))//Check to see if Email Attempt button is pressed
{
    if(isset($_POST['ID']) && !empty($_POST['ID']))
    {
    $emailattemptID = $_POST['ID'];
    $emailattemptquery = mysql_query("UPDATE Project_Submissions SET EmailAttempt=CURDATE() WHERE ID ='".$emailattemptID."' AND (EmailAttempt IS NULL OR LENGTH(EmailAttempt)=0)");

    }
}


Source: forms

Leave a Reply