View Single Post
  #2 (permalink)  
Old May 1st, 2008, 16:48
jimz jimz is offline
Up'n'Coming Member
Join Date: Feb 2006
Location: London
Age: 25
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Directing user to a "thanks" page

Hi Craig,

The best way to do it would be to redirect the user to another page if the mail has been sent

PHP: Select all

// if the mail was sent successfully
if(mail($to$subject$body))

    
// redirect the user to another page
    
header('Location: http://www.example.com/'); exit;
}
else
{
    
// otherwise, tell them something went wrong
    
echo 'Oops!';

You must not output any html before the header() function, so no using echo/print or any whitespace before your opening php tags!

Give that a shot
Reply With Quote