Forum Moderators: coopster

Message Too Old, No Replies

Formatting user input for mail() in PHP

Best way?

         

Nick_W

9:17 am on Nov 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

I have to build an newsletter script and I'd like to know the best way to format the clients message.

They put in the message in a form and then hit send, right? --- So, how can I wrap the text at 72chars and not worry about the way they've inputed in the text field?

Many thanks....

Nick

NameNick

9:57 am on Nov 14, 2002 (gmt 0)

10+ Year Member



Nick_W,

You could use the function wordwrap [php.net]() to do this.

php.net:

wordwrap -- Wraps a string to a given number of characters using a string break character.

$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap( $text, 20 );

NN

Nick_W

10:01 am on Nov 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nice one! Hadn't seen that before ;)

Thanks Nick

Nick