Validation Form redirect to new form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TG

    Validation Form redirect to new form

    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!


  • Matthias Esken

    #2
    Re: Validation Form redirect to new form

    "TG" <tgillette1@cox .net> schrieb:
    [color=blue]
    > 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?[/color]

    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

    Comment

    • CountScubula

      #3
      Re: Validation Form redirect to new form

      "TG" <tgillette1@cox .net> wrote in message news:<tuQHb.124 09$JD6.11538@la keread04>...[color=blue]
      > 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![/color]


      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

      Comment

      • TG

        #4
        Re: Validation Form redirect to new form

        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.h tm">

        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.



        "CountScubu la" <scantek@hotmai l.com> wrote in message
        news:ed2d44d4.0 312290328.22449 cb4@posting.goo gle.com...[color=blue]
        > "TG" <tgillette1@cox .net> wrote in message[/color]
        news:<tuQHb.124 09$JD6.11538@la keread04>...[color=blue][color=green]
        > > I have a validation form that must behave differently based on the[/color][/color]
        results[color=blue][color=green]
        > > of a PHP validation check. I have a post command at the top of my form[/color][/color]
        that[color=blue][color=green]
        > > calls itself. I don't leave the form when performing the validation[/color][/color]
        check on[color=blue][color=green]
        > > 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[/color][/color]
        into[color=blue][color=green]
        > > the form are incorrect, I display a warning message on the screen for[/color][/color]
        the[color=blue][color=green]
        > > fields that are in error.
        > >
        > > This works fine...
        > >
        > > However, if all the values that have been entered are "correct" -- I[/color][/color]
        want[color=blue][color=green]
        > > the form to open up "another" form without reposting to this same form.[/color][/color]
        So,[color=blue][color=green]
        > > after I perform the first post that validates the inputs into the form[/color][/color]
        (by[color=blue][color=green]
        > > 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![/color]
        >
        >
        > 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[/color]


        Comment

        • CountScubula

          #5
          Re: Validation Form redirect to new form

          > This form when posts calls itself with: <form method="post"[color=blue]
          > action="Order.h tm">
          >
          > 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.
          >[/color]

          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("Locatio n: http://www.yoursite.co m/continue_page.h tm");

          or

          if ($orderOk == 1){
          include("contin ue_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

          Comment

          Working...