Page 1 of 1
Enters turn into spaces
Posted: Tue Oct 28, 2003 3:05 pm
by Rob
Whenever a user enters a story and sends to the server, anywhere they hit enter (to make a new line...) it turns into a space instead..what do I do?
Posted: Tue Oct 28, 2003 3:12 pm
by qads
Code: Select all
<?php
$blockoftext = nl2br($_POST['blockoftext']);
?>
make sure you use it before inserting the record into the database.
Posted: Tue Oct 28, 2003 6:35 pm
by Rob
Thanks that worked
Posted: Wed Oct 29, 2003 5:05 am
by twigletmac
Don't use nl2br() before putting data into the database, because then when you come to edit the record you'll get a bunch of unwanted <br />'s, instead only use nl2br() when you display the story and keep it unchanged in the database.
Mac
Posted: Wed Oct 29, 2003 5:06 am
by twigletmac
P.S. The enters are being changed into new line characters (\n on *nix, \r\n on Windows and \r, IIRC, on Macs).
Mac