You’ve already got a check for $_POST
== empty.
**if (!empty($_POST)){
$pfs = pfs_submit($_POST,$_FILES);
echo json_encode($pfs);
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($pfs, true)."\n";
wp_redirect("http://domda.se/tack/");
exit;
} else {
/* TODO: translate following */
_e('Den här sidan hade du inte behövt se, något är fel.','pfs_domain');
echo "<a href="".get_bloginfo("url')."'>" . __('Go home?','pfs_domain') . "</a>";
}**
Add an error handler there. You will need to pass a parameter through wp_redirect
…
wp_redirect("http://domda.se/tack/?myerror=error-code");
And process it on the receiving page…
if (isset($_GET['myerror'])) {
// do stuff
}