...

View Full Version : Replacing returns



Richard
12-27-2003, 06:15 PM
I have written a form which submits to a php page which displays the stuff entered into the form.

If I put this for example in one of the form text boxes:

Blah blah.

This is an example.

It will show as "Blah blah. This is an example." when printed on the php page, because there is a return between 'blah.' and 'This'.

How do I replace the return with '<br><br>' ?

bcarl314
12-27-2003, 06:23 PM
nl2br($_POST['myVar']);

me'
12-27-2003, 06:29 PM
Documentaton for nl2br() (http://uk2.php.net/manual/en/function.nl2br.php)

Nightfire
12-27-2003, 06:53 PM
<?php
$str = $_POST['str'];

echo str_replace("/n","<br><br>",$str);
?>

Richard
12-27-2003, 08:33 PM
Originally posted by bcarl314
nl2br($_POST['myVar']);

Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum