Get Method Works but not Post Method on PHP 5.0.4 pages

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

    Get Method Works but not Post Method on PHP 5.0.4 pages

    I am unable to display PHP pages generated by a submission of a form
    using a POST method. To illustrate this, I created a very simple form
    called TestForm.php .


    <!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 Form</title>
    </head>
    <body>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <table>
    <tr><td>Name</td><td><input type="text" name="name0"/></td></tr>
    <tr><td>Age</td><td><input type="text" name="age0"/></td></tr>
    </table>
    <input type="submit" name="SubmitMe" value="Submitte d" />
    </form>
    </body>
    </html>

    I first set the method for the form to GET and the page loaded again
    after the submit.
    When I changed the method back to POST, I received a Page Not Found
    error page.
    I created another page testform3.php to display the Form Values after
    submit. I changed the action on the form to testform3.php.

    I am frustrated.
    Windows 2k Server SP4
    IIS 5
    PHP 5.04
    MySQL 4.1.11

    Any and all help would be appreciated.

    Michael

  • Nicolas Peyrussie

    #2
    Re: Get Method Works but not Post Method on PHP 5.0.4 pages

    I don't understand your problem, your code works for me (with GET as
    well as with POST methods), the page loads again after submitting.

    mickbw wrote:[color=blue]
    > I am unable to display PHP pages generated by a submission of a form
    > using a POST method. To illustrate this, I created a very simple form
    > called TestForm.php .
    >
    >
    > <!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 Form</title>
    > </head>
    > <body>
    > <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    > <table>
    > <tr><td>Name</td><td><input type="text" name="name0"/></td></tr>
    > <tr><td>Age</td><td><input type="text" name="age0"/></td></tr>
    > </table>
    > <input type="submit" name="SubmitMe" value="Submitte d" />
    > </form>
    > </body>
    > </html>
    >
    > I first set the method for the form to GET and the page loaded again
    > after the submit.
    > When I changed the method back to POST, I received a Page Not Found
    > error page.
    > I created another page testform3.php to display the Form Values after
    > submit. I changed the action on the form to testform3.php.
    >
    > I am frustrated.
    > Windows 2k Server SP4
    > IIS 5
    > PHP 5.04
    > MySQL 4.1.11
    >
    > Any and all help would be appreciated.
    >
    > Michael
    >[/color]

    Comment

    • mickbw

      #3
      Re: Get Method Works but not Post Method on PHP 5.0.4 pages

      Thanks for the Reply.

      I know it should work. It works if I test it on my workstation or on
      another server. The problem is that even a simple page like this is
      not working on a Win2k Server with PHP 5.04 and IIS 5.0 installed on
      it.

      I'm sure it is a setting that I've missed but I'm not seeing it.

      Michael

      Comment

      • Andy Hassall

        #4
        Re: Get Method Works but not Post Method on PHP 5.0.4 pages

        On 28 Apr 2005 07:20:09 -0700, "mickbw" <mickbw@gmail.c om> wrote:
        [color=blue]
        >I know it should work. It works if I test it on my workstation or on
        >another server. The problem is that even a simple page like this is
        >not working on a Win2k Server with PHP 5.04 and IIS 5.0 installed on
        >it.[/color]

        Then it's probably a setting in IIS, not in PHP, in which case try:

        microsoft.publi c.inetserver.ii s

        --
        Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
        <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

        Comment

        • mickbw

          #5
          Re: Get Method Works but not Post Method on PHP 5.0.4 pages

          Andy,

          Thanks. It was IIS.

          A post at PHPBuilder sent me this info:
          Running Win2K AS + IIS5.0 + PHP 4.3.1, I ran into a nasty problem that
          I mistakenly thought had to do with something in the php.ini
          configuration. When I would try to submit a form using the HTTP method
          GET it would work, but I would get a "404 Page Not Found" error using
          the POST method.

          All my permissions were set correctly, the php.ini was configured
          correctly. It had to do with URLScan being installed on IIS (see below)

          Page 404 File Not Found Error When Using POST method in PHP (and Perl,
          and otherwise)
          -------------------------------------------

          This is related to the Microsoft URLScan utility. If you have this
          problem, the IIS administrator has probably run the IIS Lockdown tool
          as well as configured URLScan to reject this type of HTTP method when
          sent in a URL. These tools are meant to enhance web server security.

          URLScan configuration files can be found in the
          \WINNT\system32 \inetsrv\urlsca n folder on the web server. Specifically,
          the file to modify is urlscan.ini.

          The changes to make are as follows:
          1. Make sure UseAllowVerbs=1 under [options]
          2. Under the [AllowVerbs] section, list your allowed HTTP methods to
          include:
          GET
          POST

          For more information on the IIS Lockdown tool and URLScan, visit
          Gain technical skills through documentation and training, earn certifications and connect with the community


          It works now.

          Comment

          Working...