PDA

View Full Version : Parsing a Multiline Text Box


gawing
08-24-2002, 12:15 PM
I want a user to enter a list of things into a multiline text box. Each line will have one thing on it. For example, I'd like a user to enter email addresses, one per line. There might only be one email address entered, or there may be 10 entered.
I want to have a PHP script parse the data and put it in a database. How would I do this? I know how to put the values in a database if I can get the information out a line at a time.

firepages
08-24-2002, 02:48 PM
$bits=explode("\n",$textarea_fieldname);

now..

$bits[0] will hold the first line
$bits[1] the second etc etc

gawing
08-24-2002, 03:56 PM
Thanks. It works perfectly. I'm using in a recommend script on my site at http://pcin.net/recommend.php