It's possible to redirect the browser to another page with pass parameter to that page with POST method ?

Take an example, there is a form in a.php which POST parameter to b.php. And b.php will verify the argument and redirect user to appropriate page (c.php). And b.php should pass all the parameter which received from a.php to c.php. And i don't want the parameter appear inside the address bar for security reasons, so i need to forward all the data by POST method.

Without the use of cookies or session, it's possible ? I checked some of the past question, i can see that there is some library that can call POST actions in a php but most of them just return the "reply" header, but not redirect the browser.

thanks.

    Did You think abuot SESSION vars?

      I recommend using sessions, but if you can't or really don't want to, use forms. They're not secure since a look at the source of the generated page will show all the data.

      If you use forms, you can use hidden fields to obscure the data passed.

      <?php

      put some code here to build the query list

      if( $HTTP_POST_VARS[username] == "bob" ) {
      print header( "Location: c.php?$querylist" );
      }
      ?>

      <BODY>
      <form method='POST' action='<?php print $php_self;?>'>
      <input type=hidden name=username value=<?php print username;?>>
      <input type=submit>
      </form>
      </BODY>

      This is probably not explained very well. Let me know if there is anything you need cleared up.

      -Rich

        um..
        I get your meaning Rich 🙂

        I better use session i think.
        thanks anyway, Rich and Domenico.

        I ask this question is just out of curiosity. It's because after i searched for some past questions in forum, there's no solution for my question.

        Thanks

          Can you explain more about session?

          Here is what I want to do..

          I want to pass different values to different steps in one script..

          This is a example of what I am talking about.

          <form method="POST" action=http://www.traffic-exchange.com/test.php>
          <input type=hidden name=page1>
          <input type=hidden name=testing1>
          <input type=submit value=page1>
          </form>

          once clicked the page will show the hidden
          files.. this is just a example.. I want to
          pass other information including user and
          pass..

          These examples do not work they are just examples I want to know how to do them in session..

          <form method="POST" action=http://www.traffic-exchange.com/test.php>
          <input type=hidden name=page2>
          <input type=hidden name=testing2>
          <input type=submit value=page2>
          </form>

          <form method="POST" action=http://www.traffic-exchange.com/test.php>
          <input type=hidden name=page3>
          <input type=hidden name=testing3>
          <input type=submit value=page3>
          </form>

          I would like any help I could get on this..

            I could go through some elaborate examples and explanation of how to use sessions and how they work, but in this case, I believe the manual is the best source for information. Check out:
            http://www.phpbuilder.com/manual/ref.session.php

            Try the example(s) and try adding variables that you'd like to have retained. Example 1 would be especially easy to play with, in my opinion.

            Hope this helps!

            -Rich

              a year later

              Another option is http_post. It is a script I found a while back that I used on a couple of shopping carts. I haven't been able to find it again. It allows your script to do the post without a user action. Do a search in the archive here for http_post. I found the link to it the first time in an old link in htis forum. Really cool script.

                Write a Reply...