Curtis,

What is the syntax for passing these values through the url?
Greg





Curtis Poe <[EMAIL PROTECTED]>
10/25/2001 01:44 PM
Please respond to poec

 
        To:     [EMAIL PROTECTED], [EMAIL PROTECTED]
        cc: 
        Subject:        Re: Faking form variables


--- [EMAIL PROTECTED] wrote:
> I'm using the following snippet of code to put all form data passed into 
a 
> hash table.
> 
> $form_data_size = $ENV{'CONTENT_LENGTH'};
> read (STDIN, $form_data, $form_data_size);
> @info_returned = split (/&/,$form_data);
> 
> foreach $keyvalue (@info_returned)
> {
>     ($key, $value) = split(/=/, $keyvalue);
>     $value =~ tr/+/ /;
>     $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C",hex($1))/eg;
>     $pairs{$key} = $value;
> }
> 
> is there a way to build a url that will pass data that is then parsed 
out 
> into a hash table.
> 
> what I want to do is be able to have a regular link on a webpage that 
> points to this one and also passes a parameter to it.
> this code sample works fine if I use a form on the referring page to 
pass 
> my info, but that's not what I want.

The reason your code doesn't handle your request is because parameters 
embedded in the URL are in
$ENV{QUERY_STRING} and are considered a GET request.  Your snippet reads 
the parameters from
STDIN, which is how POST requests are handled.

The simple way to deal with both (and to eliminate your code):

    use CGI qw/:cgi-lib/;
    use strict;
    my %pairs = Vars;

That snippet deals with either GET or POST requests.

Cheers,
Curtis "Ovid" Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to