hi,
You can use nl2br().
Here's a simple example:
Remember that there are some security measures that you should follow when receiving user input!HTML Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>line breaks</title> </head> <body> <?php if (isset ($_POST['Submit'])) { $input = $_POST['input']; $input = nl2br ($input); echo $input; } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="application/x-www-form-urlencoded" name="form1" target="_self" id="form1"> <textarea name="input" id="input"></textarea> <br /> <input type="submit" name="Submit" value="Submit" /> </form> <?php } ?> </body> </html>




Reply With Quote