Luinrandir Hernsen wrote:

> Thank you for your help but I want to learn this too....
>
> Here is the code from the HTML GET

First, I am sort of mystified as to why you want to use the GET method.  This method 
is designed specifically for cases where you want to download the specified file.  It 
is as likely as anything to just confuse the server.  The method for posting 
information is POST.


> <a href="move.pl?direction=NW&amp;cx=5&amp;cy=10&amp;player=Lou;">North
> West</a>
>
> And here I think is the CGI code
>
> $input=$ENV{QUERY_STRING};
>     @pairs = split(/&/, $input);

Good so far, but there are issues with portability.  There apparently are some 
protocols that use a semi-colon rather than ampersand for joining request elements.  
Therefpore, you might want to use /[&;]/ as you split parameter

>
>          foreach $pair (@pairs)
>          {
>          ($name, $value)=split(/=/,$pair);

Problem:  you still have spaces showing as plus signs, and any control characters 
encoded as twodigit hex preceded by a percent sign: ['%2C' for ','].  It will take a 
coule more lines to restore these:
   $value =~( tr/+/ /);     # restores spaces
   $value =~ s/%([a-fA-F0-9][a-fA-f0-9])/pack("C", hex($1))/eg;
                                       # replaces hex escapes with ascii equivalents


>          $form{$name}= $value;
>          }
>     $direction=$form(direction);
>     $cx=$form(cx);
>     $cy=$form(cy);
>     $player=$form(player);
>
> This should break it down so
>     $direction=NW
>     $cx=5
>     $cy=10
>     $player=Lou

Joseph


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

Reply via email to