Validation code tips
You have two long if blocks:

if (isset($_POST['submit'])) {
    if (isset($_SESSION['token']) &amp;&amp; $_POST['token'] == $_SESSION['token']) {
    ...
    }
}


Why not combine them?

if (isset($_POST['submit']) &amp;&amp; (isset($_SESSION['token']) &amp;&amp; $_POST['token'] == $_SESSION['token'])) {
    ...
}


also the way you've structured this, you don't need $error, to see if there are errors you can simply check empty($errors) (true => ok, false => not ok).

Other than that, your code looks fine.