Home > Archive > PHP Programming > May 2006 > errors after downloading a .csv file from php
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
errors after downloading a .csv file from php
|
|
| Justin 2006-05-28, 9:58 pm |
| Hi,
i created a button for my user to download their datas (.csv).
everything goes well but after u save/download the file. the website
seems to stop working.
i got two frames, the left frame is a list of menus for the users such
as add records, view records, logout etc. the right(main) frame are the
contents of what the had selected. For example: the users can click on
the "View Records" function on the left, then the main frame will show
3 buttons: "View all" "Search" "Download". if they click download and
save the file. the left frame doesn react if the user try to click add
record or other func. But if the user click cancel when the dialog box
which ask them to download appears, everything goes back to normal. Or
after downloading, if they click "View all" "Search" it also goes back
to normal. so wat's wrong? below is the coding:
$a=<<<A
<form action="" method="post">
<input type="submit" name="download" value="Download"> Click here to
download the data
</form>
A;
if(isset($_POST['download']))
{
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=data.csv");
print ("field1,field2,field3")."\n";
$query = "SELECT * FROM data";
$result = mysql_query($query);
while($row = mysql_fetch_row($result)){
print implode(",", $row)."\n";
};
mysql_free_result($result);
exit();
}
echo $a;
| |
| Justin 2006-05-28, 9:58 pm |
| by the way, this only occurs in IE6.0, it works perfectly in IE7.0 or
opera... Thanx...
|
|
|
|
|