I have a working emial form below thatsubmits to one person on the list of students. I was told to loop the emails thru and tohaveit sleep for 10sec before it loops the next email through. That is were I have the problem I do not know how to do that. I have tryied for about 2 weeks know and it is driving me crazy.

Below isthe working email code that only sends to one person.

PHP Code:

    
if ($_POST['submit'] == TRUE)  {

      
$receiverMail "$title1, ";

    
$namestripslashes(strip_tags($_POST['Name']));

    
$subjectstripslashes(strip_tags($_POST['subject']));

    
$emailstripslashes(strip_tags($_POST['Email']));

    
$Cphonestripslashes(strip_tags($_POST['Contact_Number']));

    
$contactstripslashes(strip_tags($_POST['Comment']));

    
$ip$_SERVER['REMOTE_ADDR'];

    
$msgformat    "From: $name \nEmail: $email\nContact_Number: $Cphone\n\nComment: $contact";


    if(empty(
$name) || empty($email)) {

        echo 
"<h2 style='font-family:Georgia;;background-color:#fa9283;font-weight:bold;'><center>* &nbsp;* &nbsp;The email was NOT sent!&nbsp; *&nbsp; *</h2><br><br><h3><center>* &nbsp;* &nbsp;Please fill all the required fields&nbsp; *&nbsp; *</h3><br><br>";

    }

    elseif(!
ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {

        echo 
"<h2 style='font-family:Georgia;;background-color:#fa9283;font-weight:bold;'><center>* &nbsp;* &nbsp;The email was NOT sent!&nbsp; *&nbsp; *</h2><br><br><h3><center>* &nbsp;* &nbsp;The email address is invalid&nbsp; *&nbsp; *</h3><br><br>";

    }

    elseif(
mail($receiverMail$subject$msgformat"From: $name <$email>")) {

        echo 
"<h2 style='font-family:Georgia;;background-color:#acd8f9;font-weight:bold;'><center>* Your Information has been sent! *</h2><br><br><h3><center>Your mail has been sent to Your Class List <u>Thank You</u>!</h3><br><br>"; }

    else {

        echo 
"<h2 style='font-family:Georgia;;background-color:#fa9283;font-weight:bold;'><center>* &nbsp;* &nbsp;The email was NOT sent!&nbsp; *&nbsp; *</h2><br><br><h3><center>Please try again... If the problem continues there's probably something wrong with the server.</h3><br><br>";

    }

}

echo 
"<form enctype='multipart/form-data' method='post' action=''>";
echo 
"<input type=hidden name='subject' value='News form Karate Club'>";
echo 
"<table width='440' align='left'><tr>";
echo 
"<td><font size='3' color='#990000'>Name:</td><td><input type=text id='Name' name='Name' size='25'></td>";
echo 
"</tr><tr>";
echo 
"<td><font size='3' color='#990000'>Email:</td><td><input type=text id='Email' name='Email' size='25'></td>";
echo 
"</tr><tr>";  
echo 
"<td><font size='3' color='#990000'>Phone:</td><td><input type=text id='Contact_Number' name='Contact_Number' size='15'></td>";
echo 
"</tr><tr>";
echo 
"<td><font size='3' color='#990000'>Comment:</td><td><textarea cols='32' rows='8' name='Comment' id='Comment' size>";
echo 
"</textarea></td>";
echo 
"</tr><tr>";
echo 
"<input id='submit' type='submit' name='submit' value='Submit to Student List'></center><br>";
echo 
"</td></tr></table>";
echo 
"</form>"
this bit of code is what needs to be looped

PHP Code:
    $receiverMail "$title1, "
the $title1 var comes from earlier in the page wher I pull info to list the name and email address next to the form so the instructor can see who they are mailing. the code is below.

PHP Code:

$count 
$s ;

// now you can display the results returned

  
while ($rowmysql_fetch_array($result)) {

  
$title $row["Name"];

  
$title1 $row["Email"];

  echo 
"<tr><td width='170'>$title</td><td width='170'>$title1</td></tr>";

  
$count++ ;

  }

echo 
"</table>"
that list all the emails in order one under each other. When I put it into the code I added a space and a comma so to seperate each email buy so to send it in bulk but there was a problem with a not working and b viewing as spam. I was told to do one every 10 seconds so that youwill not go past your server quota incase I send to the whole school of over a thousand. I was given the code

PHP Code:
sleep (10
to putin and allow it to pause for 10 seconds then resubmit the next looped email email. That is where the problem is I have no idea how to do that.

PLEASE ADVISE, need to know how to loop through the database and email every 10 seconds the next student ??????