Problem with POST variables (PHP5)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nicko

    #1

    Problem with POST variables (PHP5)

    Hey everyone,

    I'm on a server running PHP 5.0.5 but we've discovered that there's a
    problem with it. We cannot create a form with method "POST" because it
    simply will not post the form data (using HTML 4.01 Strict).

    If we switch the method to a "GET", it _will_ work! Would anyone here be
    able to explain it? I've already sent a message to our host but more out
    of curiousity, I want to know if anyone else has experienced this before.

    An example is here: http://www.webmarkdesigns.com.au/my_test.php5

    You'll notice: Array ( )
    which represents a print_r($_REQUE ST) call - press the submit button and
    see what happens!

    Thanks for your help in understanding this,
    Nicko.
  • Steve

    #2
    Re: Problem with POST variables (PHP5)

    On Tue, 07 Feb 2006 01:57:36 +0000, Nicko wrote:
    [color=blue]
    > Hey everyone,
    >
    > I'm on a server running PHP 5.0.5 but we've discovered that there's a
    > problem with it. We cannot create a form with method "POST" because it
    > simply will not post the form data (using HTML 4.01 Strict).
    >
    > If we switch the method to a "GET", it _will_ work! Would anyone here be
    > able to explain it? I've already sent a message to our host but more out
    > of curiousity, I want to know if anyone else has experienced this before.
    >
    > An example is here: http://www.webmarkdesigns.com.au/my_test.php5
    >
    > You'll notice: Array ( )
    > which represents a print_r($_REQUE ST) call - press the submit button and
    > see what happens!
    >
    > Thanks for your help in understanding this,
    > Nicko.[/color]
    What does print_r return if you access $_POST directly?

    Comment

    • Nicko

      #3
      Re: Problem with POST variables (PHP5)

      Steve wrote:[color=blue]
      > What does print_r return if you access $_POST directly?[/color]

      The exact same thing...

      Comment

      • samudasu

        #4
        Re: Problem with POST variables (PHP5)

        It could be that your host has the variables_order directive in the
        php.ini file is mis-configured. It usually defaults to "EPGCS". If you
        run the code below and find that "P" is missing then this is the
        problem. This directive can be set in php.ini, .htaccess or httpd.conf.

        $order = ini_get('variab les_order');
        print $order;

        Comment

        • Nicko

          #5
          Re: Problem with POST variables (PHP5)

          samudasu wrote:[color=blue]
          > If you run the code below and find that "P" is missing then this is the
          > problem. This directive can be set in php.ini, .htaccess or httpd.conf.[/color]

          Okay, ran the code and the only difference is that the P is set _after_
          the G...

          EGPCS instead of EPGCS

          Could that be the problem? And how would I set that in an .htaccess file
          (I thought that was only for Apache configuration)?

          Comment

          • samudasu

            #6
            Re: Problem with POST variables (PHP5)

            EGPCS is the correct default, sorry for the typo. There are several PHP
            directives that can be set in httpd.conf and .htaccess files but it
            doesn't seem variables_order is the problem in this case although you
            can try.


            Comment

            • Iván Sánchez Ortega

              #7
              Re: Problem with POST variables (PHP5)

              -----BEGIN PGP SIGNED MESSAGE-----
              Hash: SHA1

              Nicko wrote:
              [color=blue]
              > I'm on a server running PHP 5.0.5 but we've discovered that there's a
              > problem with it. We cannot create a form with method "POST" because it
              > simply will not post the form data (using HTML 4.01 Strict).[/color]
              [color=blue]
              > The browser is posting the data, that's not the problem.
              > You'll notice: Array ( )
              > which represents a print_r($_REQUE ST) call - press the submit button and
              > see what happens![/color]

              You might as well replace that with a call to phpinfo(); . Not very clean,
              but you'll get the contents of every defined superglobal cariable.

              - --
              - ----------------------------------
              Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

              Envejecer es el único medio de vivir mucho tiempo.
              -----BEGIN PGP SIGNATURE-----
              Version: GnuPG v1.4.2 (GNU/Linux)

              iD8DBQFD6GEW3jc Q2mg3Pc8RAslBAJ wOAfTis6g5iSTms KpK8EQaK75ylQCd Gd30
              sH78msMnaOW2igV LcAcB5cg=
              =hsV5
              -----END PGP SIGNATURE-----

              Comment

              • Nicko

                #8
                Re: Problem with POST variables (PHP5)

                Iván Sánchez Ortega wrote:[color=blue]
                > You might as well replace that with a call to phpinfo(); . Not very clean,
                > but you'll get the contents of every defined superglobal cariable.[/color]

                hmm... Probably wouldn't be willing to do that but I did discover that
                it may have been a bug in some earlier versions of PHP 5 [we are using
                5.0.5] - http://bugs.php.net/bug.php?id=31417

                Could this be the problem? I'll send this to my host anyway and let them
                play with it.

                Thanks for everyone's responses.

                Nicko.

                Comment

                • Jim Michaels

                  #9
                  Re: Problem with POST variables (PHP5)

                  it doesn't look like you are using HTML strict like you were saying. in
                  fact, there is no DTD. you should try using one, not that it would help
                  much.
                  This is what I saw for HTML. You shouldn't be outputting stuff before HTML
                  element anyway.

                  I tried this form and look what I got...
                  Array ( [abc] => 123 )
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-

                  transitional.dt d">
                  <html xmlns="http://www.w3.org/1999/xhtml">
                  <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
                  <title>test me</title>
                  </head>

                  <body>
                  <form action="http://www.webmarkdesi gns.com.au/my_test.php5?ab c=123"
                  method="post">
                  <input type="text" name="txtMe" value="Test">
                  <input type="submit" value="Submit">
                  </form>
                  </body>
                  </html>

                  you appear to be using $_GET[] or $_REQUEST[], not $_POST[] in your
                  print_r().



                  "samudasu" <samudasu@hotma il.com> wrote in message
                  news:1139302438 .061221.56970@z 14g2000cwz.goog legroups.com...[color=blue]
                  > EGPCS is the correct default, sorry for the typo. There are several PHP
                  > directives that can be set in httpd.conf and .htaccess files but it
                  > doesn't seem variables_order is the problem in this case although you
                  > can try.
                  > http://us2.php.net/configuration.changes
                  >[/color]


                  Comment

                  • Nicko

                    #10
                    Re: Problem with POST variables (PHP5)

                    Jim Michaels wrote:[color=blue]
                    > it doesn't look like you are using HTML strict like you were saying. in
                    > fact, there is no DTD. you should try using one, not that it would help
                    > much.
                    > This is what I saw for HTML. You shouldn't be outputting stuff before HTML
                    > element anyway.[/color]

                    Take my word for it, it doesn't make a difference. We've been tackling
                    this problem for a while now and there's simply been no solution.
                    Currently, we're trying to use an intermediary PHP4 script to put all
                    the post variables in the $_SESSION array so that we can use them later.
                    That seems to be the best solution, just not sure if PHP4 will share
                    it's $_SESSION array with PHP5...

                    Nick.

                    Comment

                    Working...