| Author |
redirect after send form to email with message
|
|
| Big Moxy 2007-09-30, 7:01 pm |
| 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
| |
| Rik Wasmus 2007-09-30, 7:01 pm |
| On Sun, 30 Sep 2007 18:05:09 +0200, Big Moxy <bigmoxy@gmail.com> wrote:
> 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'] =3D=3D "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 '=3D=3D' to '=3D'... 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
| |
| Krustov 2007-09-30, 7:01 pm |
| <comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.331313.203090@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) {"<br> Thank 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
| |
| Big Moxy 2007-09-30, 7:01 pm |
| On Sep 30, 10:39 am, Krustov <m...@privacy.net> wrote:
> <comp.lang.php>
> <Big Moxy>
> <Sun, 30 Sep 2007 09:05:09 -0700>
> <1191168309.331313.203...@o80g2000hse.googlegroups.com>
>
>
>
> 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) {"<br> Thank 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
| |
| Big Moxy 2007-09-30, 7:01 pm |
| On Sep 30, 10:12 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Sun, 30 Sep 2007 18:05:09 +0200, Big Moxy <bigm...@gmail.com> wrote:
>
>
>
>
> 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!!
| |
| Krustov 2007-09-30, 7:01 pm |
| <comp.lang.php>
<Big Moxy>
<Sun, 30 Sep 2007 10:19:10 -0700>
<1191172750.284452.225190@r29g2000hsg.googlegroups.com>
>
> 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
| |
| Jerry Stuckle 2007-09-30, 7:01 pm |
| Big Moxy wrote:
> On Sep 30, 10:39 am, Krustov <m...@privacy.net> wrote:
>
> 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.
jstucklex@attglobal.net
==================
| |
| Shelly 2007-09-30, 7:01 pm |
|
"Big Moxy" <bigmoxy@gmail.com> wrote in message
news:1191172750.284452.225190@r29g2000hsg.googlegroups.com...
> On Sep 30, 10:39 am, Krustov <m...@privacy.net> wrote:
>
> 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
| |
| Shelly 2007-09-30, 7:01 pm |
|
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:W6adnfYtA_AaeWLbnZ2dnUVZ_g-dnZ2d@comcast.com...
> Big Moxy wrote:
>
> 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
| |
| Rik Wasmus 2007-09-30, 7:01 pm |
| On Sun, 30 Sep 2007 18:39:01 +0200, Krustov <me@privacy.net> wrote:
> <comp.lang.php>
> <Big Moxy>
> <Sun, 30 Sep 2007 09:05:09 -0700>
> <1191168309.331313.203090@o80g2000hse.googlegroups.com>
>
will[color=darkred]
>
> 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.ph=
p =
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
| |
| Sanders Kaufman 2007-09-30, 7:01 pm |
| "Big Moxy" <bigmoxy@gmail.com> wrote in message
news:1191168309.331313.203090@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");
>
> 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
>
|
|
|
|