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

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

 



My application is using all sorts of libraries, from pear db, quickform to smarty. So it was difficult for me to provide the sample code.

Now I have just created a simple upload file (please copy and paste from below). Which does nothing but logs the access to find out about double post.

I had tried many different php versions and all produced same problem. Let me know what you find out. If you'll upload a small text file you'll see that there are two entries in log file for one access.

The platform to test is IIS (ISAPI) php 5 and Internet explorer 6. (IE 7 may not post values twice but it will display some page not found error.)



<?php
set_time_limit ( 300);

if (@$_POST['submitted'] == 'yes')
{
$csv_file = $_FILES['csv_file'];
if ($csv_file['size'] > 0)
{
 $fp = fopen('access.txt', 'a');
 fwrite($fp, 'Accessed at '. date('d-m-y H:i:s u'). "\r\n");
 fclose($fp);

 header('Location:http://www.google.com');
 exit;

}
else if ($csv_file['error'] == UPLOAD_ERR_FORM_SIZE || $csv_file['error'] == UPLOAD_ERR_INI_SIZE)
{
 $error = "File size exceeds max allowed size of whatever";

}
else
{
 $error = "There was error in uploading your file.";

}

}

?>
<html>
<head>
<title>
test
</title>
</head>
<body>
<?php
if (isset($error))
{
echo "<B>$error</B>";
}
?>
<form method="post" enctype="multipart/form-data">
<input type="file" name="csv_file" />
<input type="hidden" name="submitted" value="yes" />
<input type="submit" value="Submit" />
</form>
</body>
</html>




----- Original Message ----- From: Dan Shirah
To: Sukhwinder Singh
Cc: php-windows@xxxxxxxxxxxxx
Sent: Thursday, June 26, 2008 1:31 AM
Subject: Re: IE/ IIS / PHP - Form posted twice in case of redirection


Are you sure it's not something in your code?

I am also using IE/IIS/PHP and I have a form that on submission closes the page and opens up a new window displaying "Your data has been saved" and it does not create 2 rows in my MSSQL database.

Dan

--
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