i shoot a mail once the mail goes i want to redirect tosame page if(mail($mail_to,$mail_sub,$mail_mesg,$mail_from)) { exit; } }
i shoot a mail once the mail goes i want to redirect tosame page if(mail($mail_to,$mail_sub,$mail_mesg,$mail_from)) { exit; } } i used all the redirect options above exit; none of them are working.
based on the above the reason why it is not redirecting is because, once you send the mail you are exiting. Take the exit out of that if. You possibly might be looking for: if(mail($mail_to,$mail_sub,$mail_mesg,$mail_from)) { Header("Location: http://www.new_url.com/"); } else { exit; } HTH
Remember, the Header statement has to be before the <head>! So: if(mail($mail_to,$mail_sub,$mail_mesg,$mail_from)) { Header("Location: http://www.new_url.com/"); } else { exit; } <head> PHP:
x-x-x is right. Please note, if you're using the code in this way, you don't have to put <head> or other HTML code in the page, as in no case it will be shown ( if mail is sent, you got redirected; if mail not gets sent, you get an exit(), so that nothing will show up. I'ld suggest using this kind of code: <? if(mail($mail_to,$mail_sub,$mail_mesg,$mail_from)) { Header("Location: http://www.new_url.com/"); } else { echo "<b>Error:</b> The email could not be sent."; } ?> PHP: