By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,869 Members | 1,756 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,869 IT Pros & Developers. It's quick & easy.

redirect after send form to email with message

P: n/a
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

Sep 30 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Sun, 30 Sep 2007 18:05:09 +0200, Big Moxy <bi*****@gmail.comwrote:
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
Change '==' to '='... it's an assignment. And as soon as the erroroutput
there disappears, you can do a header redirect. (BTW: displaying errors is
OK for development offcourse, disable it on a live server though).
--
Rik Wasmus
Sep 30 '07 #2

P: n/a
<comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<11**********************@o80g2000hse.googlegroups .com>
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");
Why not send the user straight to the index.php page instead of
apply.php page ? .
Put the following on your form page .....

<input type="hidden" name="passform" value="1">

Put the following in the index.php page .....

<?php
$msg=$_REQUEST['passform'];
if ($msg==1) {"<brThank you for your request! Someone will be
contacting you soon. <br>";}
?>
The rest of your index.php page will de displayed as normal .
--
(c) The Amazing Krustov
Sep 30 '07 #3

P: n/a
On Sep 30, 10:39 am, Krustov <m...@privacy.netwrote:
<comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.331313.203...@o80g2000hse.googlegroups .com>
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");

Why not send the user straight to the index.php page instead of
apply.php page ? .

Put the following on your form page .....

<input type="hidden" name="passform" value="1">

Put the following in the index.php page .....

<?php
$msg=$_REQUEST['passform'];
if ($msg==1) {"<brThank you for your request! Someone will be
contacting you soon. <br>";}
?>

The rest of your index.php page will de displayed as normal .

--
(c) The Amazing Krustov
I set it up so the form posts to the apply page to processes the form
input and send the email. I suppose I could do it all on the index
page but generally prefer not to.

Thanks,
Tim
Sep 30 '07 #4

P: n/a
On Sep 30, 10:12 am, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
On Sun, 30 Sep 2007 18:05:09 +0200, Big Moxy <bigm...@gmail.comwrote:
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

Change '==' to '='... it's an assignment. And as soon as the error output
there disappears, you can do a header redirect. (BTW: displaying errors is
OK for development offcourse, disable it on a live server though).
--
Rik Wasmus
Thank you for pointing out the double = sign!!

Sep 30 '07 #5

P: n/a
<comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 10:19:10 -0700>
<11**********************@r29g2000hsg.googlegroups .com>
<?php
$msg=$_REQUEST['passform'];
if ($msg==1) {"<brThank you for your request! Someone will be
contacting you soon. <br>";}
?>

The rest of your index.php page will de displayed as normal .

--
(c) The Amazing Krustov

I set it up so the form posts to the apply page to processes the form
input and send the email. I suppose I could do it all on the index
page but generally prefer not to.
<?php
$msg=$_REQUEST['passform'];
if ($msg==1) {include('process.php');}
?>

With the following at the top of the process.php page ...

if ($msg<>1) {return;}

Although in general i suppose it isnt a good way to do it .
--
(c) The Amazing Krustov
Sep 30 '07 #6

P: n/a
Big Moxy wrote:
On Sep 30, 10:39 am, Krustov <m...@privacy.netwrote:
><comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.331313.203...@o80g2000hse.googlegroup s.com>
>>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");
Why not send the user straight to the index.php page instead of
apply.php page ? .

Put the following on your form page .....

<input type="hidden" name="passform" value="1">

Put the following in the index.php page .....

<?php
$msg=$_REQUEST['passform'];
if ($msg==1) {"<brThank you for your request! Someone will be
contacting you soon. <br>";}
?>

The rest of your index.php page will de displayed as normal .

--
(c) The Amazing Krustov

I set it up so the form posts to the apply page to processes the form
input and send the email. I suppose I could do it all on the index
page but generally prefer not to.

Thanks,
Tim

I'm the same way, Tim. I like to keep my processing separate, and do it
like you do. And it beats having an index.php page which dozens of
conditional include statements.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 30 '07 #7

P: n/a

"Big Moxy" <bi*****@gmail.comwrote in message
news:11**********************@r29g2000hsg.googlegr oups.com...
On Sep 30, 10:39 am, Krustov <m...@privacy.netwrote:
><comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.331313.203...@o80g2000hse.googlegroup s.com>
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");

Why not send the user straight to the index.php page instead of
apply.php page ? .

Put the following on your form page .....

<input type="hidden" name="passform" value="1">

Put the following in the index.php page .....

<?php
$msg=$_REQUEST['passform'];
if ($msg==1) {"<brThank you for your request! Someone will be
contacting you soon. <br>";}
?>

The rest of your index.php page will de displayed as normal .

--
(c) The Amazing Krustov

I set it up so the form posts to the apply page to processes the form
input and send the email. I suppose I could do it all on the index
page but generally prefer not to.

Thanks,
Tim
....or not have the apply page put up any html at all and at the end of
processing redirect to the index page via a header statement.

Shelly
Sep 30 '07 #8

P: n/a

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:W6******************************@comcast.com. ..
Big Moxy wrote:
>On Sep 30, 10:39 am, Krustov <m...@privacy.netwrote:
>><comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.331313.203...@o80g2000hse.googlegrou ps.com>

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");
Why not send the user straight to the index.php page instead of
apply.php page ? .

Put the following on your form page .....

<input type="hidden" name="passform" value="1">

Put the following in the index.php page .....

<?php
$msg=$_REQUEST['passform'];
if ($msg==1) {"<brThank you for your request! Someone will be
contacting you soon. <br>";}
?>

The rest of your index.php page will de displayed as normal .

--
(c) The Amazing Krustov

I set it up so the form posts to the apply page to processes the form
input and send the email. I suppose I could do it all on the index
page but generally prefer not to.

Thanks,
Tim


I'm the same way, Tim. I like to keep my processing separate, and do it
like you do. And it beats having an index.php page which dozens of
conditional include statements.
This is gettin dangerous, Jerry (after owu knock-down, drag-out :-) ), but
we are in agreement too often lately.

Shelly
Sep 30 '07 #9

P: n/a
On Sun, 30 Sep 2007 18:39:01 +0200, Krustov <me@privacy.netwrote:
<comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<11**********************@o80g2000hse.googlegroups .com>
>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! Someonewill
be contacting you soon.";
header("location:index.php");

Why not send the user straight to the index.php page instead of
apply.php page ? .
1. Having different scripts doing actual work keeps things clear and
easily managable. Sure, You could have a whole site in just one index.php
page. Would you do that?
2. On as side note: Doing a header redirect prevents those pesky 'do you
want to resubmit you information?' alerts from UA's on a refresh.
--
Rik Wasmus
Sep 30 '07 #10

P: n/a
"Big Moxy" <bi*****@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
>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
After $_SESSION, you used two equals where you should have had one.


>
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

Sep 30 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.