Controlling user flow with forms

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

    Controlling user flow with forms

    I have a screen where I ask the user their payment type. Once they
    select the payment type either check or credit card, I would like them
    to go to a seperate checkout page. How can I write a bit of code to
    make .php re-direct them to the proper page? (I considered doing this
    with Javascript, but would rather keep it all in .php)

    Thanks,
    jason@davispowe rs.com
  • Jeremy Shovan

    #2
    Re: Controlling user flow with forms

    Are you validating the credit card before you redirect them

    Jeremy

    Jason wrote:
    [color=blue]
    > I have a screen where I ask the user their payment type. Once they
    > select the payment type either check or credit card, I would like them
    > to go to a seperate checkout page. How can I write a bit of code to
    > make .php re-direct them to the proper page? (I considered doing this
    > with Javascript, but would rather keep it all in .php)
    >
    > Thanks,
    > jason@davispowe rs.com[/color]

    Comment

    • Agelmar

      #3
      Re: Controlling user flow with forms

      Jason wrote:[color=blue]
      > I have a screen where I ask the user their payment type. Once they
      > select the payment type either check or credit card, I would like them
      > to go to a seperate checkout page. How can I write a bit of code to
      > make .php re-direct them to the proper page? (I considered doing this
      > with Javascript, but would rather keep it all in .php)
      >
      > Thanks,
      > jason@davispowe rs.com[/color]

      Two things you can do.
      1) (my preferred method): Just have it on the same page, and output
      different things on that page based on the payment type.

      for example:
      if ($_GET['paymentType'] == "creditcard ")
      {
      // output the form for credit card crap
      }
      else
      {
      // output for check etc
      }

      2) If they are radically different and it really is appropriate to send them
      to different actual pages, you can do (at the top of the page, before
      *anything* is outputted, including blank spaces/lines etc)

      <?php
      // process whatever you need to, but output NOTHING
      if ($_GET['procType'] == "creditcard ")
      header("Locatio n: http://www.mysite.com/creditcard.php" );
      else
      header("Locatio n: http://www.mysite.com/otherpayment.ph p");
      ?>


      Comment

      • FLEB

        #4
        Re: Controlling user flow with forms

        Regarding this well-known quote, often attributed to Jason's famous "2 Jan
        2004 11:17:46 -0800" speech:
        [color=blue]
        > I have a screen where I ask the user their payment type. Once they
        > select the payment type either check or credit card, I would like them
        > to go to a seperate checkout page. How can I write a bit of code to
        > make .php re-direct them to the proper page? (I considered doing this
        > with Javascript, but would rather keep it all in .php)
        >
        > Thanks,
        > jason@davispowe rs.com[/color]

        What's the problem in just having a "Check" and a "Credit Card" link in
        plain HTML?

        --
        -- Rudy Fleminger
        -- sp@mmers.and.ev il.ones.will.bo w-down-to.us
        (put "Hey!" in the Subject line for priority processing!)
        -- http://www.pixelsaredead.com

        Comment

        Working...