NYCPHP Meetup

NYPHP.org

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

Jerry Kapron nyphp at NewAgeWeb.com
Fri Jan 31 19:12:12 EST 2003


This is a simplified version of what I do to pass POST data:

These two functions are included in all my scripts:

function post_save() {
        if(count($_POST))

              $_SESSION['post_around'] = $_POST;
       }
}


function post_read() {
       if(!count($_POST) && isset($_SESSION['post_around']) ) {
              $_POST = $_SESSION['post_around'];
              unset($_SESSION['post_around']);
       }
}


I place this code near the top of each script:

session_start();
post_read();

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

post_save();

Hope this helps,
Jerry]


--
42.7% of all statistics are made up on the spot.

-----Original Message-----
From: Webapprentice <webapprentice at onemain.com>
Subject: Re: [nycphp-talk] Passing some form values through to a redirected
page...


>Ok, this is an easy way, no doubt.
>
>How would I do this via POST?  Some form fields may not be presentable
>to the screen.
>
>--Stephen
>
>nyphp at jimbishop.org wrote:
>
>>>Upon a successful submission of the form on my PHP page, I use the
>>>header("Location: ") function to redirect to another page.  I'd like
>>>to carry over some form values over to the redirected page to use.
>>>Is this possible?  Or is there another way to do this?  I don't think
>>>it's a good idea to embed the second page into the main PHP page as
>>>the main PHP page will be very long.
>>>
>>>
>>
>>
>>the easiest way is to just:
>>
>>Location:  http://url.com/?name=value&name1=value1
>>
>>then on the corresponding grab the values in the $_GET hash.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>--- Unsubscribe at http://nyphp.org/list/ ---
>
>




More information about the talk mailing list