I'm unsure exactly what you're trying to achieve. Are you expecting a URL like search_results.shtml?query=this+is+my+query and you want to pass the "query=this+is+my+query" portion to search_script.pl?

I've used the following SSI code (the Apache 2.0 mod_include documentation is a good read) for extracting cookies and turning them into query-strings which may or may not help you:

<!--#if expr='$HTTP_COOKIE = /query=([^;]+)/' --> <!--#set var='queryval' value='$1' --> <!--#elif expr='$QUERY_STRING = /query=([^\x26]+)/' --> <!--#set var='queryval' value='$1' --> <!--#else --> <!--#set var='queryval' value='' --> <!--#endif --> <!--#include virtual="/cgi-bin/search_script.pl?query=$queryval" -->

Some notes on the above. This code hunts for a cookie named "query". If it exists it sets an environment variable called "queryval" with the contents of that cookie. Otherwise it looks for the "query" parameter in the query string (passed by the HTTP GET). If it finds it then the environment variable "queryval" gets set. Otherwise "queryval" is set to nothing.

Oh, and \x26 is an ampersand (&). I escaped this character for my own personal reasons (you can just replace it with & if you prefer).

I know what I've provided is a bit more convoluted but is this along the lines of what you're trying to find out?


In reply to Re: Extract form fields & values from query string of http_referrer by monarch
in thread Extract form fields & values from query string of http_referrer by punch_card_don

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.