Easy as pie.

Firstly, make sure your TEXTAREA tab has the 'wrap' attribute set to 'hard'.
You can set the number of characters per line by using the 'cols' attribute.
So if you want to do a hard wrap every 75 characters, use <TEXTAREA
name="yourText" wrap="hard" cols="75">.

Next, in your PHP script, run the text through nl2br() to add the <BR> tags,
and run it through strtr("\"", "'") to change the double-quotes to single

You'll also want to run the text through addslashes() before you submit it
to the database - to prevent people from passing commands to the database
through your form.

Hope that helps!

Uchendu Nwachukwu
newsreply AT unndunn DOT com - www.unndunn.com

"R" <[EMAIL PROTECTED]> wrote in message
> Greetings All,
> (Special greetings go out to Steve for excellient previous help - Thanks
> again dude)
> Calling all PHP gurus, have broked my head over this but cant seem to
> this out in c,perl or java servlets.
> Am new to PHP so dont even know the common functions leave alone the
> to this problem.
> Heres the setup:
> I have a form with just one TEXTAREA
> Data from this form is entered directly into the database
> BUT...
> everytime a user presses the ENTER or RETURN key on the keyboard, when the
> PHP script validates the form
> I want it to add <br> it should also add a <br> if the line is
> charactors long & if there is no <br> or enter key pressed..
> If it finds any "  it should convert it to '
> Any ideas?
> Any help appreciated.
> Have a great day.
> -Ryan A.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to