473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Validation Form redirect to new form

TG
I have a validation form that must behave differently based on the results
of a PHP validation check. I have a post command at the top of my form that
calls itself. I don't leave the form when performing the validation check on
the values that were entered into the form, I simply repost the form to
perform the PHP validation. If any of the values that have been entered into
the form are incorrect, I display a warning message on the screen for the
fields that are in error.

This works fine...

However, if all the values that have been entered are "correct" -- I want
the form to open up "another" form without reposting to this same form. So,
after I perform the first post that validates the inputs into the form (by
calling itself) how can I redirect the user to another form if the
validation checks are all successful? What is the syntax for doing this?

Thanks!
Jul 17 '05 #1
4 9926
"TG" <tg********@cox.net> schrieb:
However, if all the values that have been entered are "correct" -- I want
the form to open up "another" form without reposting to this same form. So,
after I perform the first post that validates the inputs into the form (by
calling itself) how can I redirect the user to another form if the
validation checks are all successful? What is the syntax for doing this?


header ('Location: http://www.example.com/new_page.php');
exit;

Please keep in mind that there is no output allowed before this
Statement and the sometimes used short way
header ('Location: new_page.php');
is invalid.

Have a look at http://www.php.net/manual/en/function.header.php for more
information.

Regards,
Matthias
Jul 17 '05 #2
"TG" <tg********@cox.net> wrote in message news:<tuQHb.12409$JD6.11538@lakeread04>...
I have a validation form that must behave differently based on the results
of a PHP validation check. I have a post command at the top of my form that
calls itself. I don't leave the form when performing the validation check on
the values that were entered into the form, I simply repost the form to
perform the PHP validation. If any of the values that have been entered into
the form are incorrect, I display a warning message on the screen for the
fields that are in error.

This works fine...

However, if all the values that have been entered are "correct" -- I want
the form to open up "another" form without reposting to this same form. So,
after I perform the first post that validates the inputs into the form (by
calling itself) how can I redirect the user to another form if the
validation checks are all successful? What is the syntax for doing this?

Thanks!

Ok, I am not following you, but am I correct in assuming that you have
a script post to itself over and over, and the validation is done in
the script?

if this is so, the if all valid, show a differnt page with a
confirm/submit or just change the form tag when it is displayed.

Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #3
TG
Let me restate my issue:

I have an input form that takes user information, address, phone, etc....

This form when posts calls itself with: <form method="post"
action="Order.htm">

The name of the form is Order.htm and is posted back to Order.htm. I do this
so the check is performed within the Order.htm form. The server has parse
html as php set so that the post command works.

However, if all the validations are successful, I want the Order.htm form to
automatically redirect to the next form after the Order.htm form has passed
all validation checks.

I hope this better explains the functionality I would like.

"CountScubula" <sc*****@hotmail.com> wrote in message
news:ed**************************@posting.google.c om...
"TG" <tg********@cox.net> wrote in message

news:<tuQHb.12409$JD6.11538@lakeread04>...
I have a validation form that must behave differently based on the results of a PHP validation check. I have a post command at the top of my form that calls itself. I don't leave the form when performing the validation check on the values that were entered into the form, I simply repost the form to
perform the PHP validation. If any of the values that have been entered into the form are incorrect, I display a warning message on the screen for the fields that are in error.

This works fine...

However, if all the values that have been entered are "correct" -- I want the form to open up "another" form without reposting to this same form. So, after I perform the first post that validates the inputs into the form (by calling itself) how can I redirect the user to another form if the
validation checks are all successful? What is the syntax for doing this?

Thanks!

Ok, I am not following you, but am I correct in assuming that you have
a script post to itself over and over, and the validation is done in
the script?

if this is so, the if all valid, show a differnt page with a
confirm/submit or just change the form tag when it is displayed.

Mike Bradley
http://gzen.myhq.info -- free online php tools

Jul 17 '05 #4
> This form when posts calls itself with: <form method="post"
action="Order.htm">

The name of the form is Order.htm and is posted back to Order.htm. I do this
so the check is performed within the Order.htm form. The server has parse
html as php set so that the post command works.

However, if all the validations are successful, I want the Order.htm form to
automatically redirect to the next form after the Order.htm form has passed
all validation checks.

I hope this better explains the functionality I would like.


Gotcha ;)

ok, set a variable such as $orderOk = 1 if all things are validated.

then do this BEFORE ANY HTML IS PASSED OUT, thus if all is good, they
continue, if not the script goes on and show what you already have

if ($orderOk == 1)
header("Location: http://www.yoursite.com/continue_page.htm");

or

if ($orderOk == 1){
include("continue_page.htm");
exit();
}
With the latter method, all the form variables can be passed to your
continue page, and there can be script in there as well.
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #5

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

Similar topics

11
by: peebrain | last post by:
I understand how to validate form data when a form is submitted to 'self' (ie. action="$_SERVER_"). In this case you simply validate before processing. However, what if submitting the form to...
6
by: Hernán Castelo | last post by:
should i to validate all the "Request"s calls like Request.FORM("...") and Request.Cookies("...") ???? if it is so, i have to see inside every "Input" elements like "Text" and even "Hidden"...
1
by: Tony | last post by:
Hi folks, I've got a bit of a problem. I have a situation where I build forms completely dynamically based on a form definition supplied from a database. Anyway, I noticed that required fields...
4
by: usl2222 | last post by:
Hi folks, I appreciate any assistance in the following problem: I have a form with a bunch of dynamic controls on it. All the controls are dynamically generated on a server, including all...
7
by: h7qvnk7q001 | last post by:
I'm trying to implement a simple server-side form validation (No Javascript). If the user submits a form with errors, I want to redisplay the same form with the errors highlighted. Once the form...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
3
by: hardieca | last post by:
Hi, I've created an n-tier app where validation rules reside in the business layer. When a webform is saved, a business object examines its state, and if some property is invalid, throws a...
8
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
3
by: satishknight | last post by:
Hi, Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
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...
0
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...
0
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...
0
agi2029
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,...

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.