Re: text insertion

From: Date: Wed, 10 Aug 2011 20:38:04 +0000
Subject: Re: text insertion
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-314466@lists.php.net to get a copy of this message
You could try using markdown too. Sent from my iPhone On Aug 10, 2011, at 3:57 PM, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote: > > > Chris Stinemetz <chrisstinemetz@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 >> prevent SQL injection; >> >> But when I call the data with php from the database the format it was >> inserted is not preserved. Is there a way to make sure when a user >> adds new paragraphs or indentation it will be preserved? >> >> Thank you, >> >> Chris >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php > > 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 is actually being output. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > -- > Sent from my Android phone with K-9 Mail. Please excuse my brevity. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#314466) next »