in reply to Pushing along the Query_String

If you are using CGI.pm, then there is a way to accept a query string if using a POST. You will need to uncomment a line. Its line 448 in version 2.752.
# Some people want to have their cake and eat it too! # Uncomment this line to have the contents of the query string # APPENDED to the POST data. # $query_string .= (length($query_string) ? '&' : '') . $ENV{'QUERY_ST +RING'} if defined $ENV{'QUERY_STRING'};
This will give you access to the CGI params, but if you just want the whole string in $ENV{QUERY_STRING}, then you need to put it in your form tag.
<FORM method=POST action="test.cgi?$ENV{QUERY_STRING}">

Then again you could just do something like this.
<INPUT type="hidden" name="query_string" value="$ENV{QUERY_STRING}">
Then access it in the next cgi like this
my $query_string = $cgi->param('query_string');

Replies are listed 'Best First'.
Re: Re: Pushing along the Query_String
by peppiv (Curate) on Jul 08, 2003 at 14:16 UTC
    Thanks for the help. I didn't want to break into the CGI.pm and make any changes. So I tried you're other two possibilities to no avail. The Google Ad Campaign gets me to the first landing page with this URL:

    http://www.newservice.com/new_offer.html?src=google&c=D1&ag=2&kw=discount+family&id=1057670384

    It's a flat html file with a form in it. When I tried to add the Query_String, it wouldn't accept it's value. I was able to push it along once using JavaScript and the location.search method. But I couldn't get it to read from there.

    Any other ideas are more than welcome!

    peppiv

      It's a flat html file with a form in it.

      Well that's the problem right there. You're either going to have to convert that to an SSI or a cgi script or put a modperl handler on top of it -- you need to jam the incoming query params onto the form so they're passed along.

      -derby

      update: There may be a javascript solution but my brain doesn't even want to go there.