[PHP] text insertion

2011-08-10 Thread Chris Stinemetz
How do I preserve text formatting when text is inserted into a database table? For example: I am using a textarea to allow users to leave comments into the database and I am using: ' . mysql_real_escape_string($_POST['store_comments']) . ', to prevent SQL injection; But when I call the data

Re: [PHP] text insertion

2011-08-10 Thread Ashley Sheridan
Chris Stinemetz chrisstinem...@gmail.com wrote: How do I preserve text formatting when text is inserted into a database table? For example: I am using a textarea to allow users to leave comments into the database and I am using: ' . mysql_real_escape_string($_POST['store_comments']) . ', to

Re: [PHP] text insertion

2011-08-10 Thread Chris Stinemetz
Are you sure its not preserved? When you output text in a browser, by default its output as html, not plain text. Html ignores extraneous whitespace, and doesn't use a monospaced font, so formatting text into columns in a textarea won't work either. Look at the html source code to see what

Re: [PHP] text insertion

2011-08-10 Thread Shaun Farrell
You could try using markdown too. Sent from my iPhone On Aug 10, 2011, at 3:57 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Chris Stinemetz chrisstinem...@gmail.com wrote: How do I preserve text formatting when text is inserted into a database table? For example: I am using

Re: [PHP] text insertion

2011-08-10 Thread Daniel P. Brown
:On Wed, Aug 10, 2011 at 16:02, Chris Stinemetz chrisstinem...@gmail.com wrote: Are you sure its not preserved? When you output text in a browser, by default its output as html, not plain text. Html ignores extraneous whitespace, and doesn't use a monospaced font, so formatting text into

Re: [PHP] text insertion

2011-08-10 Thread Chris Stinemetz
   Use HTML 'pre' tags:        pre?php echo $your_content; ?/pre I just tried that and that puts all the text on a single line. echo 'tr class=topic-post td class=user-poststrong' . $posts_row['first_name'] . ' ' . $posts_row['last_name'] . ' ' . date('m-d-Y h:iA',

Re: [PHP] text insertion

2011-08-10 Thread hdedeyan
how about echo nl2br($your_content); - Original Message - From: Chris Stinemetz chrisstinem...@gmail.com Date: Wednesday, August 10, 2011 5:09 pm Subject: Re: [PHP] text insertion To: Daniel P. Brown daniel.br...@parasane.net Cc: Ashley Sheridan a...@ashleysheridan.co.uk, PHP General

Re: [PHP] text insertion

2011-08-10 Thread Chris Stinemetz
No luck. Thanks. On Aug 10, 2011 4:17 PM, hdede...@videotron.ca wrote: how about echo nl2br($your_content); - Original Message - From: Chris Stinemetz chrisstinem...@gmail.com Date: Wednesday, August 10, 2011 5:09 pm Subject: Re: [PHP] text insertion To: Daniel P. Brown

Re: [PHP] text insertion

2011-08-10 Thread Daniel P. Brown
On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz chrisstinem...@gmail.com wrote: No luck. Thanks. Per list rules, please don't top-post. If the situation you're describing is accurate and correct, then pre is indeed what you want. -- /Daniel P. Brown Dedicated Servers, Cloud and Cloud

Re: Re: [PHP] text insertion

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 22:39, Daniel P. Brown daniel.br...@parasane.net wrote: On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz chrisstinem...@gmail.com wrote: No luck. Thanks. Per list rules, please don't top-post. If the situation you're describing is accurate and correct, then pre is

Re: Re: [PHP] text insertion

2011-08-10 Thread Ashley Sheridan
Tim Streater t...@clothears.org.uk wrote: On 10 Aug 2011 at 22:39, Daniel P. Brown daniel.br...@parasane.net wrote: On Wed, Aug 10, 2011 at 17:37, Chris Stinemetz chrisstinem...@gmail.com wrote: No luck. Thanks. Per list rules, please don't top-post. If the situation you're

Re: Re: [PHP] text insertion

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 22:07, Chris Stinemetz chrisstinem...@gmail.com wrote:    Use HTML 'pre' tags:        pre?php echo $your_content; ?/pre I just tried that and that puts all the text on a single line. You could write the string into another textarea, which you could make readonly for