PDA

View Full Version : Preserving spaces.


Saj
05-22-2003, 12:28 AM
Hi,

I have a textarea to which I submit the content and put it into a variable. Is it possible to preserve the new lines made by the Enter key on the keyboard so that it just doesn't convert it into a space.

Also, When submitting, it changes the characters ', ", and \s into \', \", and \\. Is there a way to stop that?

Thanks for your help.

Nightfire
05-22-2003, 12:36 AM
Use nl2br($textareaname) to keep the new lines.

Use stripslashes($textareaname) to strip slashes.

Saj
05-22-2003, 12:58 AM
That doesn't seem to work.....I have


$msg = $_POST["msg"];

// Text Area Formatting
nl2br($msg);
stripslashes($msg);
echo $msg;


It pretty much does nothing for me

Nightfire
05-22-2003, 01:07 AM
$msg = $_POST["msg"];

$msg = nl2br($msg);
$msg = stripslashes($msg);

echo $msg;

Saj
05-22-2003, 01:40 AM
Thanks...I completely forgot about that. It works well :)

DoubleV
06-13-2003, 04:31 PM
i found this thread by search (looks like it's quite recent)

here's my piece of code:
$addr = $_POST['Address'];
$addr =_nl2br($addr);
$addr = stripslashes($addr);
but i get an error saying
Fatal error: Call to undefined function: _nl2br() in /usr/local/etc/httpd/htdocs/ca/sizzlers/enquiry.php on line 15
line 15 is $addr =_nl2br($addr);
did i miss something?

missing-score
06-13-2003, 04:36 PM
There is an underscore (_) before nl2br();

DoubleV
06-13-2003, 04:51 PM
umm,
there was no underscore showing up in the page, and i did not notice that it appeared when i posted. i just deleted the space i had in that place and inserted it again and now it all works.
thanks!