Is it possible to send an email and auto redirect in single php file?

Posted by mysqllearner on Stack Overflow See other posts from Stack Overflow or by mysqllearner
Published on 2010-03-25T07:39:57Z Indexed on 2010/03/25 7:43 UTC
Read the original article Hit count: 437

Filed under:
|
|
|

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 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?

© Stack Overflow or respective owner

Related posts about php

Related posts about headers