I am fairly new to PHP programming, and I'm trying to get my head around
this one...
I have a form that I am doing validation on via PHP within the same page, so
if there is an error, a message will show to the user above the form. If all
goes well, I would like to call a processing script that I have already set
up and working to format the users response and send it out to a specified
e-mail... I'll call it processing.php
Is there a way that I can, if the form is filled out correctly, make a call
to processing.php, that will totally leave the control of form.php and do
it's processing?
I hope I'm making myself clear...
Thanks.
--
SamMan
Rip it to reply 7 2519
SamMan schrieb: Is there a way that I can, if the form is filled out correctly, make a call to processing.php, that will totally leave the control of form.php and do it's processing?
header('Location: http://www.example.com/processing.php');
exit;
I hope I'm making myself clear...
I'm not sure ... ;-)
Regards,
Matthias
"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:cd**********@usenet.esken.de... SamMan schrieb:
Is there a way that I can, if the form is filled out correctly, make a
call to processing.php, that will totally leave the control of form.php and
do it's processing?
header('Location: http://www.example.com/processing.php'); exit;
I hope I'm making myself clear...
I'm not sure ... ;-)
Regards, Matthias
The problem is that if I use the header method from within the first page
(form.php) I get an error that the headers have already been sent, or
something to that effect.... At least this is what I recall was happening
yesterday. I will give it a try again, and let you know.
Thanks.
--
SamMan
Rip it to reply
SamMan wrote: I am fairly new to PHP programming, and I'm trying to get my head around this one...
I have a form that I am doing validation on via PHP within the same page, so if there is an error, a message will show to the user above the form. If all goes well, I would like to call a processing script that I have already set up and working to format the users response and send it out to a specified e-mail... I'll call it processing.php
Is there a way that I can, if the form is filled out correctly, make a call to processing.php, that will totally leave the control of form.php and do it's processing?
I hope I'm making myself clear... Thanks.
basically use hidden flag fields to tell you when everything is okay
if (isset($flag))
{
form method=post) // using no method says to use this file
<input type=hidden name=flag value=1>
fill in the form and if it is incorrect have them make corrections
if no corrections needed, then add a hidden field called okay
form with all correct variables action=processing.php
} else
{
form method=post) // using no method says to use this file
<input type=hidden name=flag value=1>
other input fields
submit
--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:cd**********@usenet.esken.de... SamMan schrieb:
Is there a way that I can, if the form is filled out correctly, make a
call to processing.php, that will totally leave the control of form.php and
do it's processing?
header('Location: http://www.example.com/processing.php'); exit;
I hope I'm making myself clear...
I'm not sure ... ;-)
Regards, Matthias
The error that I'm getting is "Cannot modify header information - headers
already sent...". Unless I put it at the very top of the page, then it
works. This will be another challenge, as I will need to put the validation
code at the top of the page (I'm assuming) and I would like any errors to be
displayed in a specific location in the form.
Back to work!
Thanks.
--
SamMan
Rip it to reply
"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:cd**********@usenet.esken.de... SamMan schrieb:
Is there a way that I can, if the form is filled out correctly, make a
call to processing.php, that will totally leave the control of form.php and
do it's processing?
header('Location: http://www.example.com/processing.php'); exit;
I hope I'm making myself clear...
I'm not sure ... ;-)
Regards, Matthias
Matthias,
I think I have this sorted out. Doing a test page...
All the validation code is at the very top of the document, before anything.
This code checks for errors and sets a flag. If there is no error ($flag=
="false"), the processing script is called (using the header() function). In
the location that I want the error's to display, the flag is checked, and if
true, the errors displayed. Of course, this is a very simple test of the
logic.
I believe I will be able to easily transfer this logic to the form at work.
Thanks for stimulating my brain!
--
SamMan
Rip it to reply
SamMan wrote: I think I have this sorted out. Doing a test page... All the validation code is at the very top of the document, before anything. This code checks for errors and sets a flag. If there is no error ($flag= ="false"), the processing script is called (using the header() function).
That's the way I write my scripts. :-)
Regards,
Matthias
"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:ce*********@usenet.esken.de... SamMan wrote:
I think I have this sorted out. Doing a test page... All the validation code is at the very top of the document, before
anything. This code checks for errors and sets a flag. If there is no error
($flag= ="false"), the processing script is called (using the header()
function). That's the way I write my scripts. :-)
Regards, Matthias
I ended up doing it a little different....
Everything is still at the top of the doc, and a flag is set on error, but
if none, the processing (formatting of the e-mail message) is done right
there. If the message is sent successfully, then a header function is used
to redirect to a thank you page, if not, an error page.
I even took it a step further. I have made as much of the scripting into
includes as I could. I tried to separate the error checking & processing
into two separate includes, but it didn't like that, so I just made one
include. Any error message that is to be displayed is handled by an include
also. This makes for a much cleaner looking page, and helps separate the
view from the model.
Thanks again!
--
SamMan
Rip it to reply This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ben |
last post by:
hi all,
just wondering if it is possible to call a function that resides on
external php file before any <html> tag?? i have a code that sets a
cookie which needs to be called before <html> tag....
|
by: Jake j |
last post by:
Yes, this is a simple and straightforward thing to do as long as the .js
file doesn't use a function. When I try a script with a function in a
js file I can't get it to work (though it works fine...
|
by: Sivakumar Shanmugam |
last post by:
Group.. We are running on db2 UDF V8 on Sun solaris platform. I
created an UDF which calles a C-routine(SQL_API_FN). This C-routine in
turn calls an external C-function. The C-function is provided...
|
by: claus.hirth |
last post by:
If I create the function HELLO in schema S01 as follows,
@
CREATE FUNCTION S01.HELLO()
RETURNS VARCHAR(32)
EXTERNAL NAME 'UDFSRVXYZ!sayHelloWorld'
LANGUAGE JAVA
PARAMETER STYLE DB2GENERAL
NO...
|
by: Deniz Bahar |
last post by:
Hi,
I would like to call one of my functions the exact name as an existing
C library function (for example K&R2 exercises asks me to make an atof
function). If I don't include the header with...
|
by: j23 |
last post by:
I have library (static) testlib.cpp:
#include <stdarg.h>
void xxx(...)
{
char buf;
va_list args;
va_start(args, buf);
va_end(args);
}
|
by: RichN |
last post by:
I am developing a c program in Visual Studio .NET 2003. I also have an
Intel(R) Fortran compiler for MVS .NET
My fortran sourcecode already existed. I started a new fortran project and
chose to...
|
by: Adam Smith |
last post by:
Hello,
How can I call or trigger an external javascript twice in a form?
I have
<script language="JavaScript" src="country_state.js"
name="Country_State">
<script type="text/javascript"...
|
by: Newbie Coder |
last post by:
Hello all
I have 3 functions in a javacrip file (MyScript.js), which is added to an
ASP.NET 2.0 project
1) no right-click
2) no select text (copy...)
3) History.Back()'
How do I call...
|
by: teju |
last post by:
hi,
i am trying 2 merge 2 projects into one project.One project is using c
language and the other one is using c++ code.
both are working very fine independently.But now i need to merge both...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |