Better (IMHO) that you use the AJAX method as I previously linked to, for form submission. The function can then return a status code, and success/error response (as JSON if you wish) which is then displayed to the user. You can do this on same page the form is submitted on without redirecting.
Should you wish to have a redirect come from the function on success and/or error, use the Location header to specify where to redirect to.