Hey perl people, i've been googling for this problem for almost a full day now and i'm stumped. I found similar problems here on perlmonks, but none of the solutions seem to help.

First off, let me explain what i'm trying to do:

- I have a php page which i've designed my layout, it includes a perl cgi page based off the URL request paramater 's' (for example, http://myurl.com?s=foo will include foo.cgi).
- I can get perl code to execute fine when including like this

THe problem i'm having is that when i have variables posted to the php page via the GET methos (as in, i use ?s=foo), the included CGI scripts are seeing it, and for some funky reason, my POST variables do not come through.

For example: i have a file called post.cgi:
$query = new CGI; print $query->header(); foreach($query->param()) { print $_ ; } print $ENV{'CONTENT_LENGTH'}; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); print $buffer; #just for testing purposes


If i post directly to the cgi file (aka my form is <form action="post.cgi" method="POST">), it works almost perfectly. I see all the items sent from the posting page from within the foreach, and i see the number 25 from the ENV variable output, however, i dont see anything being put into $buffer.

Now, if i post to the exact same cgi file, but include it in my php page (so my form is this: <form action="./?s=post.cgi" method="POST">), the only output is 's' and '25' for the ENV output.

WHen i first saw this, i thought maybe perl uses the same ENV variable for both POST and GET, and one will overwrite the other. THis doesn't seem to be the case, however, since there is something in that ENV variable i'm outputting.

Can anyone provide some insight as to why this is happening?

In reply to GET overriding POST? by keegan

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.