There is only a line break, if the user hits enter, otherwise the textarea
will just wrap the content.
You can use the following:
$textAreaWidth = 60; //Number of cols specified for textarea
$loops = ceil(strlen($_POST['textarea']) / $textAreaWidth);
for($i = 0; $i < $loops; $i++){
$sp = $i * $textAreaWidth;
$line = substr($_POST['textarea'],$sp,$textAreaWidth);
$sql = 'insert into dbTable (fieldname) values ("'.$line.'")';
Mysql_query($sql) or die(mysql_error());
}
-----Original Message-----
From: Bill Bolte [mailto:[EMAIL PROTECTED]
Sent: 17 May 2007 11:22 PM
To: [email protected]
Subject: RE: [PHP-WIN] Textarea and mysql
Split the data on a line break maybe? First thing that comes into my
head...
-----Original Message-----
From: Moore, Joshua [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 17, 2007 4:17 PM
To: [email protected]
Subject: [PHP-WIN] Textarea and mysql
Hello,
Im currently having a bit of an issue with putting user info from a
textarea
into mysql db with php. With the textarea I need each new line to be a
separate entry into the db fields. So I guess the end result is making
the
textarea act like a regular text html form. The reason I am using
textarea is
because I want a user to paste in a long string of numbers
Ex:
11111111
22222222
33333333
....and so on
And each will end up in the same field just different entries.
Does anyone have any idea how I can accomplish this?
Thanks
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
***********************************************************************************************
The information contained in this e-mail is confidential and may be subject to
legal privilege.
Access to this e-mail by anyone other than the intended recipient is
unauthorised.
If you are not the intended recipient you must not use, copy, distribute or
disclose the e-mail or any part of its contents or take any action in reliance
on it. If you have received this e-mail in error, please notify us immediately
by e-mail ([EMAIL PROTECTED]) or telephone (+27 11 265 4200).
This message is free of all known viruses. It has been screened for viruses by
Blockmail.
***********************************************************************************************
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php