473,698 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("locatio n: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
10 20905
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("locatio n: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
<comp.lang.ph p>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<11************ **********@o80g 2000hse.googleg roups.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("locatio n: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
On Sep 30, 10:39 am, Krustov <m...@privacy.n etwrote:
<comp.lang.ph p>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.331 313.203...@o80g 2000hse.googleg roups.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("locatio n: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
On Sep 30, 10:12 am, "Rik Wasmus" <luiheidsgoe... @hotmail.comwro te:
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("locatio n: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
<comp.lang.ph p>
<Big Moxy>
<Sun, 30 Sep 2007 10:19:10 -0700>
<11************ **********@r29g 2000hsg.googleg roups.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('proce ss.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
Big Moxy wrote:
On Sep 30, 10:39 am, Krustov <m...@privacy.n etwrote:
><comp.lang.php >
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.33 1313.203...@o80 g2000hse.google groups.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("locat ion: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=$_REQUE ST['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*******@attgl obal.net
=============== ===
Sep 30 '07 #7

"Big Moxy" <bi*****@gmail. comwrote in message
news:11******** **************@ r29g2000hsg.goo glegroups.com.. .
On Sep 30, 10:39 am, Krustov <m...@privacy.n etwrote:
><comp.lang.php >
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.33 1313.203...@o80 g2000hse.google groups.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("locatio n: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=$_REQUE ST['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

"Jerry Stuckle" <js*******@attg lobal.netwrote in message
news:W6******** *************** *******@comcast .com...
Big Moxy wrote:
>On Sep 30, 10:39 am, Krustov <m...@privacy.n etwrote:
>><comp.lang.ph p>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<1191168309.3 31313.203...@o8 0g2000hse.googl egroups.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("loca tion: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=$_REQUES T['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
On Sun, 30 Sep 2007 18:39:01 +0200, Krustov <me@privacy.net wrote:
<comp.lang.ph p>
<Big Moxy>
<Sun, 30 Sep 2007 09:05:09 -0700>
<11************ **********@o80g 2000hse.googleg roups.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("locati on: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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8010
by: Damo | last post by:
Could someone please help me. I am a newbie at PHP. I downloaded formail.php Version 5.0 from Jacks scripts( http://www.dtheatre.com/scripts/ )and changed the required areas to my email address and the domain server address. (these changes were in the $recipient and $referers section) I have set up the form and can get the form to email me the results. I have two main problems. The first one is that I am trying to get the form to go to a...
11
2169
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a datagrid. I am using the viewstate object to store the Arraylist items on the page on postback. My PROBLEM is that I need to redirect the user to a new aspx page and on this new page i need to be able to access the items in my arraylist. Is this...
4
729
by: Martyn Fewtrell | last post by:
Hi there I am developing an ASP.Net form which submits to a non ASP.net script (not through choice!). Basically the form collates a whole bunch of data and builds a query string from the collected form fields. The query string is then appended on to the Url of the script and is sent using the Response.Redirect option. e.g. Response.Redirect(myquerystring)
10
7160
by: Savanah | last post by:
Hello, I would like to call another page using POST method, something like this : Response.Redirect("http://www.mydomain.com/cgi-bin/log.dll?email="+tbLoginID"). I set this in my page <form id="form1" method="post" runat="server But it's doen't work... :(
13
70000
by: deko | last post by:
I have a basic feedback form with a submit button. After the "send" button is clicked, I want the user to be redirected to a different page that says "Your message has been sent." How do I do this? I've tried using: header("Location:http://www.mysite.com/send-confirm.php");
15
3145
by: John | last post by:
Hello, I have a php contact script and I want it to redirect to my homepage without using the standard header command. <?php header("location:http://www.johndoe.com/index.html"); exit;
56
7221
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my website. The issue is that I need to gauge whether a user has any items in their basket to decide which page I redirect them too. I could
2
2313
by: sindhudixit | last post by:
Hey, I am having a user fill out a form then the fields are going to uploaded to my database. So, at this point, when the user hits the submit button I want three things to happen: 1. The form uploads to a database (the following code does this) 2. An e-mail is sent to my sales team as well as the customer, which contains the form values . 3. I want the user to then be directed automatically to another webpage, after they hit the...
18
2664
by: Paul Lautman | last post by:
JRough wrote: What do you mean by "redirect the output to Excel"??? Excel isn't a location, it's a spreadsheet program that some (but not all users) will have on their machine. BTW, Location: is supposed to take a fully qualified URL.
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.