PHPro Posted October 22, 2009 Share Posted October 22, 2009 Is there any way I can display data from notepad. Could anyone please just tell me how or tell me the function and ill google the rest. thanks! Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/ Share on other sites More sharing options...
Mchl Posted October 22, 2009 Share Posted October 22, 2009 Can you explain in more detail? Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/#findComment-942334 Share on other sites More sharing options...
PHPro Posted October 22, 2009 Author Share Posted October 22, 2009 alright! There are details of products in my notepad, for say, and I want to show those details into my details.php display them like a content. get it? Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/#findComment-942366 Share on other sites More sharing options...
Mchl Posted October 22, 2009 Share Posted October 22, 2009 So... you want to read and display data from a text file? Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/#findComment-942372 Share on other sites More sharing options...
jon23d Posted October 22, 2009 Share Posted October 22, 2009 file_get_contents() or readfile() Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/#findComment-942375 Share on other sites More sharing options...
PHPro Posted October 22, 2009 Author Share Posted October 22, 2009 This code seemed to be working.. $notes = "details/note.txt"; $handle = fopen($notes, "r"); $contents = fread($handle, filesize($notes)); echo $contents; fclose($handle); Do you guys have any idea how to arrange whats in it? because it just echoed a full text without spaces Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/#findComment-942379 Share on other sites More sharing options...
Mchl Posted October 22, 2009 Share Posted October 22, 2009 I think you mean newlines... use nl2br Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/#findComment-942380 Share on other sites More sharing options...
PHPro Posted October 22, 2009 Author Share Posted October 22, 2009 Inside my text.txt there are messages like this for example 'My name is blah blah blah'. And when I echoed my text.txt outputs like this. 'Mynameisblahblahblah '. where am I going to place nl2br() sir? thank you Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/#findComment-942385 Share on other sites More sharing options...
PHPro Posted October 22, 2009 Author Share Posted October 22, 2009 echo nl2br(contents); WORKS!!! thank you so much im really sorry for asking everything instead of trying myself first. thanks again sir Mchl and jon23d for replying Link to comment https://forums.phpfreaks.com/topic/178651-solved-read-data-in-notepad/#findComment-942388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.