Is this file located in the root of your site? If so you should update the redirect value on lines 30 and 31, you can just enter the thank you page here if all the files are in the root of the site. If you are getting the email sent then you should also be redirecting to the thank you page. If you continue to have trouble with this update the code on the page that is on line 31, add in a new line and put in an exit like this:
header("Location: /thankyou.php");
exit();
I have also saved a new version of this page for you that should get you past the headers already sent error. I saved the page from within DW and made sure that the box for 'include BOM signature' was unchecked. I did not see any white space near line 1 so this was the only other thing that I could think of. Make sure to backup your current version of this page first, then give it a try with this page. Let us know if you continue to have any problems with this.