rguyer has asked for the wisdom of the Perl Monks concerning the following question:

I'm using CGI.pm. My form submits using the GET method, even though I am calling the script with the POST method.
<form action="http://www.testsite.crawfordinfo.com/index.pl" method="P +OST">
Why would the method change to GET?

Replies are listed 'Best First'.
Re: My POST is changing to GET
by isotope (Deacon) on May 02, 2001 at 20:09 UTC
    My best guess: misbehaved browser. It doesn't sound like a problem with your CGI script. I tried the URL, I assume you're talking about the login form. It POSTs just fine for me.

    --isotope
    http://www.skylab.org/~isotope/
Re: My POST is changing to GET
by thabenksta (Pilgrim) on May 02, 2001 at 20:13 UTC

    Two questions. 1) What is happening that makes you think it's using the get method. 2) Since the code you posted looks ok, can we see some more to see if the problem is somewhere else in your code?

    -thabenksta
    my $name = 'Ben Kittrell'; $name=~s/^(.+)\s(.).+$/\L$1$2/g; my $nick = 'tha' . $name . 'sta';
      In my access log files, it shows the requests as GET instead of the POST.
      It's causing the users password to be displayed in the address bar, and it also prevents my file upload forms from working properly.

        You have a lonely <form> tag towards the top. Take that out and you will be fine.

        -thabenksta
        my $name = 'Ben Kittrell'; $name=~s/^(.+)\s(.).+$/\L$1$2/g; my $nick = 'tha' . $name . 'sta';
Re: My POST is changing to GET
by dws (Chancellor) on May 02, 2001 at 20:24 UTC
    Show use the entire form, plus any JavaScript methods (if any) that are invoked on behalf of the form.

    Also, the next time you post an HTML question, consider the question "What does this have to do with Perl?" This isn't an HTML/JavaScript help forum, though people will cut you some slack if you give some indication that Perl is involved.

Re: My POST is changing to GET
by Sinister (Friar) on May 02, 2001 at 20:10 UTC
    I suspect that this has nothing to do with perl. Seems more like a browser problem. Try a real hard refresh, and check your source-codes, better yet, post the URL of the specified CGI...

    Sinister greetings.
      The site is at: http://www.testsite.crawfordinfo.com

      If you sign in as 'test' with password 'test' you can see the browser is displaying all the form data in the address box after submit. I didn't have this problem at one time, but then I made some changes to the script (I thought unrelated changes) and now the form info shows up.

      Another side affect is file uploads. I've got another form in the site that allows the user to upload files. They won't work unless the filename is sent using the POST method.
        I think this bit of code:
        <body leftMargin=0 topMargin=0> <table bgColor=#FFFFFF border=0 cellPadding=0 cellSpacing=0 height=2 w +idth="100%"> <tr> <td align=center width="95" height="88"> <img border="0" src="http://www.testsite.crawfordinfo. +com/templates/images/cconlinelite.gif" width=95 height=88> </td> <td align=center height="88"> <a href="http://www.linuxforum.com" target="_blank" alt="Visit The Lin +ux Forum"><img border=0 src="http://www.testsite.crawfordinfo.com/ban +ner/linux.gif"></a><br> <a href="http://www.linuxforum.com" target="_blank">Visit The Linux +Forum</a> </td> <form> <td align=center width="95" height="88">&nbsp;&nbsp;&n +bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
        is your problem. C the empty <form> tag. It is never closed, default method = get.

        Have fun!

        EDIT
        if you look at the address string closely, you might notice index.pl is not in there...
        /EDIT

        Sinister greetings.