View Single Post
  #4 (permalink)  
Old May 1st, 2008, 17:07
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

Replace this:

Code: Select all
echo "Data has been submitted to $to!"; 
mail($to, $subject, $body); 
} else { 
echo "blarg!"; 
}
with this:

Code: 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!';
}

Last edited by jimz; May 1st, 2008 at 17:09.
Reply With Quote