Textarea into DB the correct way

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
facets
Forum Contributor
Posts: 273
Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit

Textarea into DB the correct way

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Neither of those are needed to insert a text area into a database.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Code: Select all

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