Add a hidden field in your form:

...
<input type="hidden" name="token" value="<?php echo $_SESSION['token'] ?>" />
...

This should be unique. Now, give it a value at the top of your file:

session_start(); # you may need this
if(!isset($_POST['submit'])) $_SESSION['token'] = md5(session_id() . time());

Then:

$token_is_good = true;

// check for double submit
if (isset($_SESSION['token'] && isset($_POST['token']) && $_POST['token'] != $_SESSION['token']) {
    $token_is_good = false;
    $_POST = array();
}

 if($token_is_good) {
    ... 
    # process the form, save to DB or whatever you want to do with data
   ...
   $_SESSION['token'] = md5(session_id() . time());
}

That’s it!