found some code on another post and slightly changed it to fit my needs but its kind of not working?
it writes the values i want to the end of the csv but also write the entire HTML of the page to the file aswell?
the contents of the CSV:
<table border=2 cellpadding=0 cellspacing=0 width=271 style='border-collapse:
collapse;table-layout:fixed;width:204pt'>
<col width=64 style='width:48pt'>
<col width=82 style='mso-width-source:userset;mso-width-alt:2998;width:62pt'>
<col width=125 style='mso-width-source:userset;mso-width-alt:4571;width:94pt'>
<tr height=20 style='height:15.0pt'>
<td colspan=3 rowspan=2 height=40 class=xl67 width=271 border=1 style='height:30.0pt;
width:204pt'><b>{AIRLINE}</b> - <b>KJFK</b> To <b>EGNT</b></td>
</tr>
<tr height=20 style='height:15.0pt'>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 border=1 class=xl69 style='height:15.0pt'><b><center>TLA</center></b></td>
<td colspan=2 class=xl65 style='border-right:.5pt solid black;border-left:
none'><b><center>102</center></b></td>
</tr>
<center><b></b></center>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt'>From:</td>
<td class=xl69 style='border-top:none'><b><center>KJFK</center></b></td>
<td class=xl69 style='border-top:none;border-left:none'>{AIRPORT NAME}</td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt'>To:</td>
<td class=xl69 style='border-top:none'><b><center>EGNT</center></b></td>
<td class=xl69 style='border-top:none;border-left:none'>{AIRPORT NAME}</td>
</tr>
<tr height=60 style='height:15.0pt'>
<td height=60 class=xl87 style='height:15.0pt'>Route:</td>
<td colspan=2 rowspan=4><b>ROUTE GOES HERE</b></td>
</tr>
<tr height=0 style='height:15.0pt'>
</tr>
<tr height=0 style='height:15.0pt'>
</tr>
<tr height=0 style='height:15.0pt'>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl88 style='height:15.0pt'>Aircraft:</td>
<td><center><b>A346</b></center></td>
<td class=xl69 style='border-top:none;border-left:none'><center><b>{AIRCRAFT NAME}</center></b></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl85 style='height:15.0pt;border-top:none'>Distance</td>
<td colspan=2 class=xl81 style='border-left:none'><center><b>3431.08</b></center></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td colspan=2 height=20 class=xl85 style='height:15.0pt'>Departure Time:<span
style='mso-spacerun:yes'> </span></td>
<td class=xl69 style='border-top:none;border-left:none'><center><b>3431.08</b></center></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td colspan=2 height=20 class=xl85 style='height:15.0pt'>Arrival Time:</td>
<td class=xl69 style='border-top:none;border-left:none'><center><b>21:00 GMT</b></center></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td colspan=2 height=20 class=xl86 style='border-right:.5pt solid black;
height:15.0pt'>Total Flight Time</td>
<td class=xl69 style='border-top:none;'><center><b>5</b></center></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td height=20 class=xl84 style='height:15.0pt;border-top:none'>Notes:</td>
<td colspan=2 rowspan=5><b>NOTES GO HERE</b></td>
</tr>
<tr height=0 style='height:15.0pt'>
</tr>
<tr height=0 style='height:15.0pt'>
</tr>
<tr height=0 style='height:15.0pt'>
</tr>
<tr height=0 style='height:15.0pt'>
</tr>
<tr height=20 style='height:15.0pt'>
<td colspan=2 height=20 class=xl85 style='height:15.0pt'>Ticket Price:</td>
<td class=xl69 style='border-top:none;border-left:none'><center><b>1756</b></center></td>
</tr>
<tr height=20 style='height:15.0pt'>
<td colspan=2 height=20 class=xl85 style='height:15.0pt'>Flight Type:</td>
<td class=xl69 style='border-top:none;border-left:none'><center><b>P</b></center></td>
</tr>
<![if supportMisalignedColumns]>
<tr height=0 style='display:none'>
<td width=64 style='width:48pt'></td>
<td width=82 style='width:62pt'></td>
<td width=125 style='width:94pt'></td>
</tr>
<![endif]>
</table>
<a href="disp_flt.php?act=dlcsv&flid=0000032">Download CSV</a>"TLA","102","KJFK","EGNT","ROUTE GOES HERE","A346","3431.08","3431.08","21:00 GMT","5","NOTES GO HERE","1756","P"
"TLA","102","KJFK","EGNT","ROUTE GOES HERE","A346","3431.08","3431.08","21:00 GMT","5","NOTES GO HERE","1756","P"
the php code:
$header = "";
$data = "$csvdata";
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=export.csv");
header("Pragma: no-cache");
header("Expires: 0");
print($header."\n".$data);
exit;
any idea on how to put just the last line in the CSV?