Am currently designing a website for a company and the problem i gat is dat the form i created for the employees. saves all letters and alpabets on one line. the enter key does not space the information. i hope somebody understand me. for example if i type:
hello pls kal
mr john.
it will save as hello pls kal mr john.. without the break line.
GumSlone wrote:
yes, you are right your solution is better, this function was made specially to insert html line break into the text.
came up with a really nice solution to a flat file writing problem when using nl2br by adding it to a modded version of gumslones.
using nl2br with txt files makes your text look like this inside the .txt file:
this is
a trial message
that im producing to
use as an example.
taking up 4 lines in the .txt file.
(when trying to show to users it may look like its coming from 1 post, but it takes up a count of 4 posts in total)
by modding gumslones code and using nl2br you can produce this inside the .txt file:
this is
a trial message
that im producing to
use as an example.
ramming everything on 1 line and once again counting as 1 post total. so the display structure is always correct.
heres what i did.
/** Call Cleanse Function And <br /> All \r\n \r \n With nl2br */
$Post = nl2br(Cleanse($_POST['post']));
/** Remove \r\n \r \n From <br /> Tags That nl2br Seem To Leave Behind. */
$Post = str_replace(array("<br />\r\n", "<br />\n", "<br />\r"), '<br/>', $Post);
//
//
//
Cleanse() is just a function i got for cleaning the posts also.
You can use php end of line, it remains \n in markup but must be in double quotes. If you don't want it change those in single quotes. Btw i don't like nl2br because its white space, i like
not
. 🙂
arnage wrote:
You can use php end of line, it remains \n in markup but must be in double quotes. If you don't want it change those in single quotes. Btw i don't like nl2br because its white space, i like
not
. 🙂