redirect after send form to email with message



I want to redirect the user back to the home page after submitting
their form inquiry and display a message on the home page. I tried
this in my send mail (apply.php) file -

$_SESSION['sent_message'] == "Thank you for your request! Someone will
be contacting you soon.";
header("location:index.php");

but got this error -

Notice: Undefined index: sent_message in /home/bigmoxy/public_html/
projects/senior/apply.php on line 12

Warning: Cannot modify header information - headers already sent by
(output started at /home/bigmoxy/public_html/projects/senior/apply.php:
12) in /home/bigmoxy/public_html/projects/senior/apply.php on line 13

Note that the redirection works without setting the message.

Can someone please advise me on how to accomplish this?

Thank you!

Tim

.



Relevant Pages

  • RE: PHP jump to other page
    ... You have an echo or print statement before the redirect (location ... PHP jump to other page ... Warning: Cannot modify header information - headers already sent by ...
    (Ubuntu)
  • Re: header() with if/then statements
    ... Cannot modify header information - headers already sent by ... I can't put the redirect before the HTML as I want the redirect to be ... You MUST put the redirect before outputting any HTML, ...
    (comp.lang.php)
  • Re: header() with if/then statements
    ... Cannot modify header information - headers already sent by ... I can't put the redirect before the HTML as I want the redirect to be ... Why don't you want the redirect before the HTML? ... This way if there are three things wrong, the user must gets an error message for the first one and corrects it. ...
    (comp.lang.php)
  • Error when doing redirect using
    ... I have index.php in the root directory and I want to redirect the request to ... Cannot modify header information - headers already sent by (output ...
    (alt.php)
  • RE: Frame for Response.Driect or Server.Transfer
    ... if the result of your server side code ... > frames to other pages. ... >> code and then redirect the user somewhere else. ... >> Response.Redirect or Server.Transfer what frame to display the page in or ...
    (microsoft.public.dotnet.framework.aspnet)