If you have a form which ob being filled, you would like the user to be redirected to another page.
In these cases if you try to post to $_SERVER['PHP_SELF'], this will not work.
The only way to handle this is to use the header() function if no other text/string data has been output by the web server to the users browser.
You'll need to put the logic for the redirect at the top of your script before anything else(Replace your redirection URL.):
The reason for this is that when a browser receives information from the web server it receives an HTTP header (which the header() function outputs the redirect to), and then outputs the body of the HTTP response after the HTTP header. If your script is echoing anything before the header command, you'll continue to receive error saying that the header information cannot be modified.
<?php
// Process form
// If processing was successful, redirect
if($success)
{
// Replace your redirection URL here
header("Location: http://www.coolcakes.net/");
}
?>
Done