How to prevent multiple submissions on the form on page refresh?

<?php

if ($_POST) {
    if ($_POST['hash'] == $_SESSION['hash']) {
        echo 'Form sent!';
    } else {
        echo 'Error: form was already sent!';
    }
}

$hash = md5(microtime());
$_SESSION['hash'] = $hash;
?>

<form method="post" action="">
    <input type="hidden" name="hash" value="<?php echo $hash ?>">

    <input type="text" name="test">
    <input type="submit" value="submit">
</form>