Connecting Tech Pros Worldwide Help | Site Map

Get Method Works but not Post Method on PHP 5.0.4 pages

  #1  
Old July 17th, 2005, 01:53 PM
mickbw
Guest
 
Posts: n/a
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.dtd">
<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="Submitted" />
</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

  #2  
Old July 17th, 2005, 01:53 PM
Nicolas Peyrussie
Guest
 
Posts: n/a

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.dtd">
> <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="Submitted" />
> </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]
  #3  
Old July 17th, 2005, 01:53 PM
mickbw
Guest
 
Posts: n/a

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

  #4  
Old July 17th, 2005, 01:54 PM
Andy Hassall
Guest
 
Posts: n/a

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.com> 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.public.inetserver.iis

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
  #5  
Old July 17th, 2005, 01:55 PM
mickbw
Guest
 
Posts: n/a

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\urlscan 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
http://technet.microsoft.com

It works now.

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code problem: Form will only work under GET method bruno_guedesav answers 8 November 22nd, 2007 05:45 AM
XMLHttpRequest and AJAX for PHP programmers geevaa answers 1 March 27th, 2007 01:55 PM
php mysql authentication problem! help dalsoth answers 2 July 30th, 2006 02:34 PM
Redirecting between PHP Pages Rob Tweed answers 25 July 17th, 2005 06:27 AM