Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

line breaks aren't working

Status
Not open for further replies.

mattster

Programmer
Apr 26, 2007
15
US
hi, this is the post form action for my forum software... For some reason, when it posts the message, line breaks in the message don't show up.. it is all on one line. Here's the code:

============================================================
<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>
<%
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.ConnectionString = &quot;DSN=mattfest&quot;
Conn.Mode = adModeReadWrite
Conn.Open &quot;mattfest&quot;, &quot;sa&quot;, &quot;&quot;
%>

<%

Author = Server.HTMLEncode(Request.Form(&quot;author&quot;))
Email = Server.HTMLEncode(Request.Form(&quot;email&quot;))
Subject = Server.HTMLEncode(Request.Form(&quot;subject&quot;))
Message = Server.HTMLEncode(Request.Form(&quot;message&quot;))
IP = Request.ServerVariables(&quot;REMOTE_ADDR&quot;)
Original = Request.QueryString(&quot;original&quot;)
TopicID = Request.QueryString(&quot;topic&quot;)
theDate = NOW

'Cookies! mmmm
' Sets cookies for the post form
Response.Cookies(&quot;lith2k&quot;)(&quot;Author&quot;)= Request.Form(&quot;Author&quot;)
Response.Cookies(&quot;lith2k&quot;)(&quot;Email&quot;)= Request.Form(&quot;Email&quot;)
Response.Cookies(&quot;lith2k&quot;).Expires= dateAdd(&quot;d&quot;, 90, now)
%>



<%


sSQL = &quot;INSERT INTO Messages(ForumID, Author, Email, Date, Subject, Message, Original, IP) Values(&quot; & TopicID & &quot;, '&quot; & Author & &quot;', '&quot; & Email & &quot;', '&quot; & theDate & &quot;', '&quot; & Subject & &quot;', '&quot; & Message & &quot;', &quot; & clng(Original) & &quot;, '&quot; & sIP & &quot;')&quot;

Set RS = Conn.Execute(sSQL)

Conn.Close
Response.Redirect &quot;main.asp?topic=&quot; & TopicID


%>
============================================================

have any idea what's wrong?
 
You need to do a replace in order to get the linebreaks to show up.

ex:
message = Replace(message, vbCrLf, &quot;<br>&quot;)

that should get your code to format properly.

hope this helps
leo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top