Each line in a Text Area

Line Separator in PHP?

Page 1 of 1

2 Replies - 8196 Views - Last Post: 17 April 2009 - 05:05 AM Rate Topic: -----

#1 sharkbate24  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 14-April 09

Each line in a Text Area

Post icon  Posted 17 April 2009 - 04:42 AM

Hi everyone,

So basically, I'm working on a script where the administrator can add email addresses line by line in a text area, and when he's finished, the script will add each line to a new row in the database.

When I say a Text Area, I mean a multiline text box.

For example, let's take this input:

person1@mail.com
person2@mail.com
person3@mail.com

The administrator can add as many email addresses as he wants as long as he adds each email address in a new line.

I want to use the PHP explode function:

array explode ( string $delimiter , string $string [, int $limit ] )
//Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter . 


The delimiter is the boundary string which I presume means that it is the thing that separates each line / each record. So what would the delimiter be for new line?

Thanks for your help!

Is This A Good Question/Topic? 0
  • +

Replies To: Each line in a Text Area

#2 SpaceMan  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 10
  • View blog
  • Posts: 507
  • Joined: 20-February 03

Re: Each line in a Text Area

Posted 17 April 2009 - 04:51 AM

r for windows, n for nix.

i use both, so not mater what OS.

\r\n


Was This Post Helpful? 0
  • +
  • -

#3 sharkbate24  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 14-April 09

Re: Each line in a Text Area

Posted 17 April 2009 - 05:05 AM

View PostSpaceMan, on 17 Apr, 2009 - 03:51 AM, said:

r for windows, n for nix.

i use both, so not mater what OS.

\r\n



Got you - thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1