Re: [PHP-DB] Form TextArea Formatting
Mark, Ignatius, John et.al., Thanks guys, I was able to use this: $Message = str_replace(" "," ",$MessageText); $MessageText = preg_replace("/(\015\012)|(\015)|(\012)/"," ", $Message); It works perfectly, at least on my Windows machine. The data is not only input from the Textarea, but it is also later displayed back in the Textarea and these to lines work perfectly for new lines, indents and spaces. Larentium - Original Message - From: "Keith Spiller" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 09, 2002 4:01 AM Subject: [PHP-DB] Form TextArea Formatting > Hello, > > I've created a web form that includes a textarea input box called > MessageText. The data from this form will be inserted into a mysql table. > My problem is that the form users will be inserting formatted text into this > textarea and I need to be able to transfer the formatting as well as the > content into the database. Right now, all formatting is lost in the > transfer. Any ideas or suggestions? > > Thank you for your help. > > Larentium > [EMAIL PROTECTED] > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Form TextArea Formatting
You would be easier reformatting when you take it out of the database. After getting your variable representing the text in the text box do this: $variable = nl2br($variable); Then when you display your variable the all your original new lines are retrieved. "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 000301c29f7a$de69b010$7c02a8c0@coconut">news:000301c29f7a$de69b010$7c02a8c0@coconut... > > I've created a web form that includes a textarea input box called > > MessageText. The data from this form will be inserted into a mysql > table. > > My problem is that the form users will be inserting formatted text > into > > this > > textarea and I need to be able to transfer the formatting as well as > the > > content into the database. Right now, all formatting is lost in the > > transfer. Any ideas or suggestions? > > If you're talking about spaces and tabs and newlines, the formatting > isn't lost. It just that HTML doesn't render tabs or newlines or more > than one space. You need to convert your plain text to HTML so it > renders correctly. Newlines are , spaces are , etc... > > These URLs may help: > > www.php.net/nl2br > www.php.net/htmlentities > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Form TextArea Formatting
> I've created a web form that includes a textarea input box called > MessageText. The data from this form will be inserted into a mysql table. > My problem is that the form users will be inserting formatted text into > this > textarea and I need to be able to transfer the formatting as well as the > content into the database. Right now, all formatting is lost in the > transfer. Any ideas or suggestions? If you're talking about spaces and tabs and newlines, the formatting isn't lost. It just that HTML doesn't render tabs or newlines or more than one space. You need to convert your plain text to HTML so it renders correctly. Newlines are , spaces are , etc... These URLs may help: www.php.net/nl2br www.php.net/htmlentities ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Form TextArea Formatting
hello, check this page for all info: http://www.php.net/manual/en/function.nl2br.php and also check out the links on that page See also htmlspecialchars(), htmlentities() and wordwrap(). hope it helps!! good luck -Original Message- From: Ignatius Reilly [mailto:[EMAIL PROTECTED]] Sent: maandag 9 december 2002 12:18 To: Keith Spiller; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Form TextArea Formatting What do you mean by formatted text? All you can enter in a textarea is a sequence of characters belonging to your encoding schema (including non-printing characters). Ignatius - Original Message - From: "Keith Spiller" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 09, 2002 12:01 PM Subject: [PHP-DB] Form TextArea Formatting > Hello, > > I've created a web form that includes a textarea input box called > MessageText. The data from this form will be inserted into a mysql table. > My problem is that the form users will be inserting formatted text into this > textarea and I need to be able to transfer the formatting as well as the > content into the database. Right now, all formatting is lost in the > transfer. Any ideas or suggestions? > > Thank you for your help. > > Larentium > [EMAIL PROTECTED] > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Form TextArea Formatting
What do you mean by formatted text? All you can enter in a textarea is a sequence of characters belonging to your encoding schema (including non-printing characters). Ignatius - Original Message - From: "Keith Spiller" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 09, 2002 12:01 PM Subject: [PHP-DB] Form TextArea Formatting > Hello, > > I've created a web form that includes a textarea input box called > MessageText. The data from this form will be inserted into a mysql table. > My problem is that the form users will be inserting formatted text into this > textarea and I need to be able to transfer the formatting as well as the > content into the database. Right now, all formatting is lost in the > transfer. Any ideas or suggestions? > > Thank you for your help. > > Larentium > [EMAIL PROTECTED] > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php