Below is the extract of the problem part of the else loop. It gives me a parse error for the header line, the url is send from the previous page and is available as $_POST['url'] in general throughout the processing script.
else
{
header( refresh: 2; url=$_POST['url'] );
echo 'Message has been sent.';}