Bruce Gust
asked on
How do I enter a textarea into my database and include line breaks?
I've got a tbody of text in a textfield that has several line breaks in it. How do I write an INSERT statement that maintains those line breaks? What do I have to do to "$text" variable to ensure that the integrity of line breaks and paragraphs is inserted correctly?
Before you enter your textarea var into database just do a string replace..
here's an example..
here's an example..
str_replace("\n","<br>",$textarea);
$sql = "insert into table ('$textarea')";
Sorry..
$textarea = str_replace("\n","<br>",$textarea);
$sql = "insert into table ('$textarea')";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hope this helps.
Open in new window