I have an HTML form that is posting to a PHP script. The user enters in email addresses in the following format: John|[email protected], Bob|[email protected], Tom|[email protected].

'|' is the delimiting character used to separate the email from the persons name, and ',' is used to separate each of these entries.

I have to types of data coming in, a persons first name, and a their email address. I wish to be able to split the emails and assign all emails to a variable (like [email protected], [email protected], [email protected]) when the form is submitted so that I can use that data in the PHP mail command. I then want the names stored to another separate variable which I can use to send to an SQL database.

I know how to do everything except for parsing the data properly.

I was using a combination of the foreach, explode, and implode statements. But honestly, I have no idea if I am on the right track.

Thanks,
-Brian