As the title said:
Is it possible to send an email (using php mail()) and after sending the email, auto redirect to another page. All开发者_如何学Go the codes will be in single php file?
Code-wise, should be something like this:
if(mail(argument...)){
header("Location: www.google.com");
}
I think I would get a: "Error: header information already sent" or something like. But what if I want to send email and then auto-redirect on that page?? Possible?
This error:
Error: header information already sent
usually caused by having white space before the opening and closing PHP tags or something was printed to the browser before preparing the page.
If this is the only code you have
if(mail(argument...)){
header("Location: www.google.com");
}
it will work because you are not printing anything to the browser but be sure to avoid including white spaces.
精彩评论