leeharvey09 Posted February 12, 2010 Share Posted February 12, 2010 i have a small script that writes input to a text file, i want each new record to be added to a newline, so its easy to read, like this, tom hanks [email protected] I have seen news stories about implants which will help the jim jones [email protected] Jaycee Dugard kept a journal during 18 years of captivity tim dog [email protected] Former President Bill Clinton had two stents placed in one mark brown [email protected] Thursday. Chief cardiologist Allan Schwartz with New York but my script produces this in the text file. $name = $_POST['sendNamehiddenField']; $email = strtolower($_POST['sendEmailhiddenField']); $message = $_POST['sendMessagehiddenField']; $feedBackRecords = array($name,$email,$message); $spaceImplode = implode(" ",$feedBackRecords); $file = "feedBackData.txt"; file_put_contents($file,$spaceImplode,FILE_APPEND); tom hanks [email protected] I have seen news stories about implants which will help the blind see.jim jones [email protected] Jaycee Dugard kept a journal during 18 years of captivitytim dog [email protected] Former President Bill Clinton had two stents placed in one of his coronary arteries onmark brown [email protected] Thursday. Chief cardiologist Allan Schwartz with New York Presbyterian Hospital says any help will be great thanks cheers Lee Harvey[/size][/size] Link to comment https://forums.phpfreaks.com/topic/191862-how-to-apend-data-to-a-new-line-in-a-text-file/ Share on other sites More sharing options...
MRushton Posted February 12, 2010 Share Posted February 12, 2010 Use this: $spaceImplode = implode(" ",$feedBackRecords) . "\n"; Link to comment https://forums.phpfreaks.com/topic/191862-how-to-apend-data-to-a-new-line-in-a-text-file/#findComment-1011274 Share on other sites More sharing options...
xjake88x Posted February 12, 2010 Share Posted February 12, 2010 You can also use "\r\n" which is called a CrLf or carriage return line feed. (It's just for cross-os compatibility) http://en.wikipedia.org/wiki/Crlf Link to comment https://forums.phpfreaks.com/topic/191862-how-to-apend-data-to-a-new-line-in-a-text-file/#findComment-1011303 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.