I am using th e following snippet to write data to a file:
$filename = $_SESSION['usrdir'].$_SESSION['claimantusername'].".clmfl";
if(is_writable($filename)){
if(!$fileHandle = fopen($filename, 'a')){
echo "<script language=javascript>alert('Cannot open file ($filename)')</script>";
exit;
}
if(fwrite($fileHandle, $dataToWrite) === FALSE){
echo "<script language=javascript>alert('Cannot write to file ($filename)')</script>";
exit;
}
echo "<script language=javascript>alert('Claim written to file successfully')</script>";
fclose($fileHandle);
}else{
echo "<script language=javascript>alert('The file ($filename) is not writable')</script>";
}
i have tested it but i cannot seem to write to a new line each time.
I want a single entry of data on a separate line
How can i make sure that $dataToWrite is on a new in the file every time??
thanx in advance