I'm sorry to ask this question about newlines. I know that there have been plenty of questions about newlines in the past, but I couldn't see an answer to this specific one - how to make a file for Excel separated by commas then newlines. Please excuse the redundant code.
<?
{
header( "Content-type: application/x-something" );
//header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=test.txt" );
header( "Content-Description: PHP3 Generated Data" );
$outputbox = StripSlashes($outputbox);
$outputbox = str_replace('newlinexxx', '\r\n', $outputbox);
// $outputbox = "1,2,3"."\r\n"."4,5,6";
echo $outputbox;
exit;
}
?>
I have created a JavaScript program (http://www.cardiacrisk.org.uk/php/refitup2.html) that takes scientific abstracts (eg www.cardiacrisk.org.uk/php/exampleabstracts.txt), makes them into a table and then outputs them to a textbox (outputbox) for processing by a PHP program (www.cardiacrisk.org.uk/php/processIt.php) - see above. To see the JavaScript program in action, cut and paste the contents of the text file into the textbox at refitup2.html
My problem is this: the Javascript program takes the original abstract and snips it up into substrings in double quotes. Because the PHP program strips the slashes I've defined newlines in the Javascript program with "newlinexxx". After the stripslash I ask the PHP program to replace with newlines as seen above.
Can anyone help me with this simple problem!
Many thanks,
Graham Mackenzie