When you enter text into a textarea in a HTML form and press enter for line breaks on your keyboard the line breaks are removed and not preserved when you display the entered text on a web page that receives the textarea value.
For example below we have the code for two pages "form.asp" and "form_receive.asp".
form.asp:
<html>
<body>
<form name="form1" method="post" action="form_receive.asp">
<textarea name="myTextareaBox" cols="30"
rows="5"></textarea>
<br>
<input name="Submit" type="submit" value="Submit">
</form>
</body>
</html>
form_receive.asp:
<html>
<body>
<%
Dim myTextAreaVariable
myTextAreaVariable= Request.form("myTextareaBox")
Response.write myTextAreaVariable
%>
</body>
</html>
In practice the code for "form.asp" would
display a textarea such as the one below. (note that the textarea
below is just an example and the submit button won't work)
If I entered the following text in the textarea below and hit
the submit button, the line breaks wouldn’t show up on our
example page "form_receive.asp" which receives and displays
the textarea value in a browser.
To ensure proper formatting our code for "receive_form.asp" would look like this:
<html>
<body>
<%
Dim myTextAreaVariable
Request.form("myTextareaBox")
MyTextAreaVariable=Replace(Request.form("MyTextareaBox"),vbCrLf,"<br>")
Response.write myTextAreaVariable
%>
</body>
</html>
Get the best asp hosting provider from web-hosting-top.com and save up to 30%
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.
