NYCPHP Meetup

NYPHP.org

[nycphp-talk] Passing some form values through to a redirected page...

Jerry Kapron jkapron at NewAgeWeb.com
Sat Feb 1 22:52:42 EST 2003


-----Original Message-----
From: Webapprentice <webapprentice at onemain.com>

>(I have to use $HTTP_POST_VARS[], because _POST[] isn't supported on the
>server I'm on).
>
>I just want to access a $HTTP_POST_VARS[] variable on the second page
>for use in a hidden form.


I modified the functions to work on your server. Include them in your
scripts and follow the instructions below.

function post_save() {
        global $HTTP_POST_VARS;
        global $HTTP_SESSION_VARS;
        if(count($HTTP_POST_VARS)) {
              $HTTP_SESSION_VARS['post_around'] = $HTTP_POST_VARS;
       }
}


function post_read() {
        global $HTTP_POST_VARS;
        global $HTTP_SESSION_VARS;
       if(!count($HTTP_POST_VARS) &&
isset($HTTP_SESSION_VARS['post_around']) ) {
              $HTTP_POST_VARS = $HTTP_SESSION_VARS['post_around'];
              unset($HTTP_SESSION_VARS['post_around']);
       }
}


Place this code near the top of each script (after the above function
definitions):

session_start();
post_read();

and this right before each header( 'Location: ...') call:

post_save();

That's all. Don't let anyone confuse you and make it seem more complicated
than it really is :)

Jerry








More information about the talk mailing list