[nycphp-talk] Passing some form values through to a redirected page...
George Webb
gw.nyphp at gwprogramming.com
Sat Feb 1 12:41:48 EST 2003
Stephen,
Sessions are OK, I guess, if you really need to keep sending
the data around, but keep in mind then, that all of that POST data
will get sent back-and-forth between the server and browser for each
successive page-load. And if you do a "Location:" redirect, that
will of course count as two page loads, so that is conceivably a
waste of time and bandwidth. Depending how your server is configured,
the additional HTTP transaction from the server might be costly if
you do it a lot, or if your server is already busy.
So you said you don't want to "embed" the 2nd script into
the first one... why not just "include" it? That way, the only
additional cost of the "redirect" is reading and executing that
file... no extra HTTP noise (which in some cases could slow things
down by more than a few seconds per page hit).
Overall, it sounds like you might be moving toward
building one single "library" file of your functions, and then your
"scripts" would include this library and call whatever functions it
needs.
Also, I don't know how much data is getting POSTed, but if
it's more than a few hundred characters (or has the potential to be),
you might have problems doing Location: redirects with all that data.
I could explain this further if it doesn't make sense.
Bestest,
George Webb
gw.nyphp at gwprogramming.com
>
> > 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.
>
>
>
More information about the talk
mailing list