PDA

View Full Version : when view not as same as when they type


doomz
04-06-2005, 05:36 AM
Hello everyone... I have some problem about making FORUM

here like this:

the posted text that on the viewpage is not the same as when the user typed

for examlpe:

when make a newpost the user type like this(multi line):

HELLO I'M NEWBIE
IT JUST
SOME TESTING.

but while on the viewpage the texts above become like this(one line)

HELLO I'M NEWBIE IT JUST SOME TESTING.


I store those text with <textarea></textarea> tags and then keep in my database with the type of data is 'memo' at ms access but when I show it, I retrieve and put them between the <table></table> tag.

what is the solution about this case, I want to make it same as the user typed and just put it on the table? pls help me

glenngv
04-06-2005, 06:09 AM
Enclose the text in <pre>text here</pre> tags to preserve formatting. Use CSS to change the font style of <pre> from the default Courier New to something else.

A1ien51
04-06-2005, 07:20 PM
When you grab the data from the form, you probaby need to format it with breaks (<br>) where there is a line feed.

glenngv
04-07-2005, 03:08 AM
It requires less server resources if you directly put the multi-line text in <pre> tags without replacing all occurrences of newlines with <br />s.

doomz
04-07-2005, 03:39 AM
Thank you very much, everybody
the <pre></pre> tags already 'settle' my case.


just want to know...about 'adding <br></br> at last line' solution

how can we detect or to know 'the end of line (Enter CR key)' and 'space' from texts that sent by user.
I guess it will need to make some codes that repeatly 'scan' every lines which sent by user to give them a <br></br> tags before we store them into database, right?

glenngv
04-07-2005, 04:54 AM
You don't need to insert <br />s in the input and store them in the database.