hello! i have form for submission articles i want to use <br> tag at the end of paragraph. please tell to me how is possible. when i press Enter Key at the end of paragraph than ASP Form Develop Auto <br> Tag in the database. because database show articles in paragraph with <br>tag how is possible.............................
Here's how I tackle it: User enters body of text in memo field code performs security checks if security checks pass, then insert text directly to database when code is rendered back to browser, do this: MyText = Replace(MyText,vbcrlf,"<br />") This handy little guy will put the <br /> tag where ever it encounters a hard return in the text.
btw - I don't think it's a good idea to store the html in the database with the text. If you ever want to use that text in a different application, say a word document, then your going to have to strip the html out to make it readable to humans. IMHO, it's much easier to 'massage' the output from the database with some code.
Hello Dwirch! what you want tell to me i can't understand please try to slowly learn to me with example thanks.....
I can only tell you how I have done it in the past. This method may or may not fit with your code. When storing the information in the database, store the raw data. But when retrieving it, put into a variable first, so you can work with it. Here is a simplified version of some code that is currently live: <div id="content"> <% 'open database connection strSQL = "SELECT * FROM tblNews WHERE NewsID=" & MyNewsID objConn.Open Set rstResults=objConn.Execute(strsql) 'set variables Dim NewsTitle Dim DateEntered Dim NewsBody 'grab content from database NewsTitle=rstResults("NewsTitle") NewsBody=rstResults("NewsBody") DateEntered=rstResults("NewsPostDate") 'close database rstResults.Close objConn.Close 'add breaks NewsBody=Replace(NewsBody,vbcrlf,"<br />") 'send output to browser %> <h3><% =NewsTitle %></h3> <p><% =DateEntered %></p> <hr> <p><% =NewsBody %></p> </div> Code (markup): So the flow is basically as described previously. Grab the data, replace the cr/lf with the <br /> tag, and send it to the browser.