vbCrLf & <br />

liunx

Guest
If a user writes text to a textarea that is stored in a database, how can I get it to preserve the line breaks when it displays the text?

Thanks...<!-- m --><a class="postlink" href="http://us2.php.net/nl2br">http://us2.php.net/nl2br</a><!-- m -->


<form action="form.php" method="post">
<textarea cols="30" rows="10" name="input"></textarea>
<input type="submit" name="send" value="enter" />
</form>
<?php
if(isset($_POST['send'])){
$input = $_POST['input'];
$input = nl2br($input);
echo $input;
}
?>


Try it out here.
<!-- m --><a class="postlink" href="http://lisr.net/form.phpI">http://lisr.net/form.phpI</a><!-- m --> did not notice that this was in the ASP room.

Maybe this is what you are looking for?
<!-- m --><a class="postlink" href="http://www.webmasterworld.com/forum47/2246.htmThanks">http://www.webmasterworld.com/forum47/2246.htmThanks</a><!-- m -->! I tried the replace function but I had the vbCrLf in quotes. Hopefully this will do it for me.that should do it. you can save them just as they were submitted however in a varchar field it doesn't show correctly in the db. but it does have them.
 
Back
Top