You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/07/14 17:38:21 UTC
Re: Question about Apache::Request and query strings
Tom Gazzini wrote:
> I have a perl function which, amongst other things, needs to redirect
> the request to another page.
>
> It also needs to pass all the query parameters of the original request
> (both GET and POST) to the redirected page, and also add one parameter
> of it's own (an error message).
>
> Sounds simple enough, but I'm having problems with the passing paramters
> bit.
>
> Here's what I have:
>
> sub show_error {
> my ($r, $error) = @_;
>
> # $r is an Apache:Request object passed by the caller
>
> my $uri = URI->new($url);
> foreach my $p (@params) {
> $uri->query_form($p => $r->param($p));
> }
> $uri->query_form(error => $error);
> $r->internal_redirect($uri->canonical);
> }
>
> But this doesn't work. The '?error=' query string gets passed, but the
> orginal request query strings don't.
>
> What am I doing wrong? And is there an easier way?
This example may help:
http://perl.apache.org/docs/1.0/guide/snippets.html#Reusing_Data_from_POST_request
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com