http get param

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm having a strang error when I try to disting my actions passed in
parameter, the parameter action is null :s

html code :

<form name="insert_form" action="/cgi-bin/recordz.cgi?lang=$LANG"
<input type="hidden" name="action" value="register">

perl code :

loadLanguage ();
execute ();

sub execute {

     my $query = new CGI ;
     my $action = $query->param('action');
#open and write to file currently action
#action is empty in my file

     my $dir = "C:/indigoperl/apache/htdocs/recordz/action.txt";
     open (FILE, ">>$dir") or die "cannot open file $dir";
     print FILE "$action\n";
     close (FILE);

     if ($action) {
    switch ($action) {
        case "login" { };
        case "logout" { };
        case "search" {};
        case "register"
else {loadPage ();}


thanks in advance

Re: http get param

Quoted text here. Click to load it

Pardon, but this sentence is gibberish.  It is impossible to guess
what you expect from the code [snipped] and in which way it doesn't
do what you expect.  Try again.


Re: http get param

Anno Siegel a écrit :
Quoted text here. Click to load it

I try to be clearer, the problem is when I try to get the parameter
action (recordz.cgi=lang=fr&action=xxxx)

he's null :(

Re: http get param

Quoted text here. Click to load it
                     ^ that is supposed to be a question mark

I dunno why you are writing it that way when it is a POST request.

params show in URLs for GET requests, not for POST requests.

POST requests come in on STDIN. Does your code read from STDIN
before creating the CGI object? (we cannot tell, because we haven't
seen a complete program.)

You should make a short and complete program *that we can run* that
illustrates your problem, eg:

# arg_echo - echo all the CGI form parameters
use warnings;
use strict;
use CGI qw/ :standard /;
use CGI::Carp qw(fatalsToBrowser);

$| = 1;

print "Content-type: text/plain\n\n";

foreach my $param ( param() ) {
   printf "   %-20s => '%s',\n", $param, param($param);

Have you seen the Posting Guidelines that are posted here frequently?

Quoted text here. Click to load it

There is no such thing as "null" in Perl, so we _still_ don't
know what the problem is.

Is it the "empty string"?  (a string of length zero)

Is it undef? (a special value in Perl that is kind of like "null" or
              "nil" in other languages.)

    Tad McClellan                          SGML consulting                   Perl programming
    Fort Worth, Texas

Re: http get param

* Alexandre Jaquet schrieb:

Quoted text here. Click to load it


Quoted text here. Click to load it

The paragraph "MIXING POST AND URL PARAMETERS" in `perldoc CGI` deals
with mixing POST and GET requests. I just mention it due to seeing
you're using it. Perhaps this doesn't solve your problem (since param
"action" is corrupt instead of "lang").

Btw, how is loadLanguage() processing the CGI params. Does it reading
all the stuff from STDIN in order that execute() cannot read the same


Site Timeline