Forum Moderators: coopster

Message Too Old, No Replies

new line \n not working

         

kumarsena

7:51 pm on Jan 17, 2004 (gmt 0)

10+ Year Member



i have the following code:

$vote= $_POST['poll'];

$results = file('fotoalbum.txt');

if ($vote=='y'){ $results[1]++; }

else { $results[0]++; }

$content = implode("\n", $results);

$fp = fopen( "fotoalbum.txt" , "w" );

fwrite($fp, $content);

fclose($fp)

but the new line \n in the implode fuction does not work, any idea what im doing wrong here...
kumar

dreamcatcher

10:01 am on Jan 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Kumarsena,

Have you tried the following?


$content .= $results . "\n";

Guardian

10:12 pm on Jan 18, 2004 (gmt 0)

10+ Year Member



It does depend on the operating system too.

Use "\n" for nix, "\r\n" for Win and "\r" for Mac

Good Luck
:)