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

Validation Form redirect to new form

P: n/a
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
Share this Question
Share on Google+
4 Replies


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

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

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

P: n/a
> 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 discussion thread is closed

Replies have been disabled for this discussion.