Page 1 of 1

Textarea into DB the correct way

Posted: Tue Aug 29, 2006 9:17 am
by facets
Hi All,

I'm using the following code to enter text into a DB.
It is sometimes dropping words or adding line breaks.
Is there a better, more effiecient way to do this?

Code: Select all

$otherDetail = ereg_replace("[^[:space:]a-zA-Z0-9*_.-]", "", $otherDetail);
$otherDetail = ereg_replace("[ \t\r\n]+", " ", $otherDetail);
ta, Will

Posted: Tue Aug 29, 2006 9:37 am
by feyd
Neither of those are needed to insert a text area into a database.

Posted: Tue Aug 29, 2006 9:38 am
by Jenk

Code: Select all

$text = mysql_real_escape_string($_POST['textarea']);