IE/ IIS / PHP - Form posted twice in case of redirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am facing a strange problem of IE double posting in case of self post. PHP 5.2.6 / IIS 5.1 on windows XP.

Before starting I must tell you that:

It works with firefox, Apache / PHP combination.

It works with IE / Apache / PHP combination

But it DOES NOT work with  IE/PHP/ IIS


This is the case with all IE versions and it happens on even the windows 2003 server.

I have a form with just one field which uploads a single file and posts back to same PHP file. The file is a csv file and it is properly read and inserted into database. After it is successfully inserted I issue a redirect to some other page using header("Location:users.php"). And when I see the records in database, they inserted twice. If I don't do the redirect to some other page And display the message on the same page that everything is all right then records are inserted only once.

It doesn't matter to what page I redirect to or if I attach any query string or not. It is just that header("Location:any_url") causes IE to submit the form TWICE. Not more than twice. I have checked the IIS logs and confirmed that form is actually getting submitted twice.

21:16:31 127.0.0.1 POST /xxx/import.php 303
21:16:31 127.0.0.1 POST /xxx/import.php 303
21:16:31 127.0.0.1 GET /xxx/users.php 200
21:16:31 127.0.0.1 GET /xxx/users.php 200

Actual path it takes to import the users is this:

users.php has a link to import.php. import php first displays a form for uploading and then posts to itself. After the files is properly uploaded and inserted into database I return the user to users.php again using that Location header. So there is no way that there is any kind of looping or something.



Just to check if it is IE which has any problem with PHP header I upgraded IE to version 7. Now when I post the form rather than posting it twice IE just displays a message "Internet Explorer cannot display the webpage" and records are into database only once.

I am not sure if it is IIS, PHP or IE Problem.

This is not the first time I have experienced this. I had earlier faced the same problem but I thought I should just switch to Apache rather than use IIS for development. But now the problem is that production server is Windows 2003 server with IIS. (The version of PHP IIS or windows shouldn't not matter though)


Thanks,

Sukhwinder Singh

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux