A common task in ASP is to take a block of text from a database or user input, and put it on a webpage to be read. Make sure that you format it nicely!
Let's say you use either a SQL statement or a request from a form to get the value
Let's say that UserComments is a long, long description that some user typed in about your product or website or favorite movie. Now you have this long description and want to show it on a browser page.
If you just say
you are going to get a GIANT block of text, all mashed together. That isn't going to be readable at all! Remember, HTML ignores simple hard returns. So all of that line break and paragraph break content that your user typed in will be lost.
Instead, use the REPLACE function to turn those line breaks into <BR> commands. HTML uses BR to determine when to move to the next line.
So the command would be
UserComments = Replace(UserComments, CHR(13), "<BR>")
Now all of those line breaks have been turned into actual BR entries. Your browser will then put line breaks in at those spots, and the content becomes nicely readable to your end users!
|Introduction to ASP Ebook|
Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.