PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
// this is what i use to create the *.ans file
$infofile = "addfaq.ans";
$openfile = fopen ($infofile, "w")
or die("Couldnt open the file");
fwrite ($openfile, $faqadd);
fclose ($openfile);
$openfile = fopen ($infofile, "r")
or die("Couldnt open the file");
$file_size=filesize($infofile);
$file_contents= fread ($openfile, $file_size);
$msg="$file_contents"; // feedback
fclose ($openfile);
// my code to open *.ans file
// txt files gave me double breaks after every line
$headline = "txt/headline.ans";
$openfile = fopen($headline , "r")
or die ("Sorry we couldnt process the request");
while (!feof ($openfile))
{
$msg = fgets($openfile, 1024);
echo "$msg", "\n";
}
yea that will give me a <br> @ the end of the text feed.
However when i write the *.ans document. Lets say a large chunk of text, the output of that text wont have breaks in the lines like i added them in the input form.
if you want to take the info from a text area and display it in a browser, nl2br() is a great function, it converts line feeds to html line breaks. haha if thats not what your after, could you post the code you're working with?