Hi I am trying to figure out a way to take email address out of a text field box and insert them as new records into a database.

I created a page with a text field and a add button.

As an example, I want to be able to paste more than one email address into the text field box. The email addresses will be seperated by commas like this (user123@blah.com, user234@blah.com, user345@blah.com, user456@blah.com and so on.) When I press the add button I want to be able to extract the emails and add them into the database as thier own entries as new email adresses. I was trying to configure a script using foreach but I can not figure out exactly how to do this.
I do not know how to extract each email individually from the text field and how to list them as a variable and enter them into the db...

Can anyone help me with this PLEASE. I am lost.

This is what I had come up with so far.

foreach (??? ????) {
        $q1 = "Insert into mail set
                                        email = '" . xss_clean(addslashes($_POST['email'])) . "'";


                echo mysql_error();
        echo "<br><center><font face=verdana size=2 color=red><b>You have sucessfully added the subscribers!";


//get the subscribers number
$q1 = "select count(*) from mail where news = 'y' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);



        function CheckNews() {

                        window.alert('Enter the new emails!');
                        return false;



<form method=post name=f1 onsubmit="return CheckNews();">
<table align=center width=350>
<caption align=center class=BlackLink>You have <?=$a1[0]?> subscribers at your mailing list.<br>
Would you like to add more subscribers?</caption>
        <td colspan=2 class=TableHead align=center>Add more subscribers!</td>

        <td valign=top>Add Emails to the DB:</td>
        <td><textarea name=message rows=10 cols=32></textarea></td>

        <td><input type=submit name=s1 value=Add! class=sub></td>