Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 29th, 2005, 10:56 PM
Authorized User
 
Join Date: Apr 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default html textarea to DB

I have a form with a textarea (rows and cols) submitting to a php form via POST, and i insert the values into SQL Server 2000 table.

works fine, but then when I try to display it again replacing the line breaks (where ever the user pushed enter in the textarea) with a BR tag, it never seems to be replaced (as if the enter key doesn't get stored.

I've tried:
 preg_replace (\r and \r\n)
 strstr (\r and \r\n)
 and
 nl2br
 
Old May 30th, 2005, 01:49 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

use enctype="multipart/form-data"
-n- continue as you did :)
$data=$_POST['post'];
$data=nl2br($data);
http://www.mediasworks.com/webstory/cghost/home.htm






Similar Threads
Thread Thread Starter Forum Replies Last Post
write HTML into TEXTAREA using PHP anshul PHP How-To 6 March 27th, 2009 12:15 PM
saving data from HTML textarea Durkee VB.NET 2002/2003 Basics 4 May 9th, 2008 09:25 AM
How to store textarea in a db? Hylsan PHP How-To 1 March 1st, 2007 07:51 AM
TEXTAREA tag in html sapphire87 PHP How-To 0 July 26th, 2006 02:25 PM
ASP: Textarea Problem when updating DB seala Access ASP 1 June 13th, 2003 12:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.