PDA

View Full Version : PHP Data saves from IE but not from Mozilla


lxm
04-29-2008, 10:35 AM
Ok I have an online survey with 4/5 pages. PHP code saves the data to a text file. In IE this works fine but in Mozilla Firefox no data is saved from the first page, however, all the data is saved from the subsequent pages.

Does anyone know why this might be?

this is the php code from the page where nothing is saved, it is the same for all the pages:

<?php

foreach ($_POST as $key => $val) {
echo '<input type="hidden" name="' . $key . '" value="' . $val . '" />' . "\r\n";

}
?>

lxm
04-29-2008, 11:14 AM
ok sorry the code that actually saves the data to a text file is on the last page it is



<?php
$File = "Results.txt";
$Handle = fopen($File, 'a');
foreach ($_POST as $key => $val) {
//fwrite ($Handle, $val);
fwrite ( $Handle, $val. "," );

}
fclose($Handle);
?>

CFMaBiSmAd
04-29-2008, 12:27 PM
If your form acts differently in different browsers, it is likely because the HTML markup is incorrect and the form is invalid. One browser ignores the errors and submits the data while the other browser does not.

You would need to post your form (do a "view source" of it in your browser and copy and paste it in a post.)

justanormalteen
04-30-2008, 11:09 AM
You should also validate all files before you test them so you will know ahead of time about any problems that might arise because of incorrect code.