What I have is a page with a form where someone would input there email and edit a prespecified email messege.
Here is the code
<html>
<body>
<?
//check to see if form has been submited
if (array_key_exists ('formsubmission',$_POST))
{
$email1=$_POST['femail'];
$message=$_POST['fcomments'];
//check if valid email domain was input
list($userName, $mailDomain) = split("@", $email1);
if (checkdnsrr($mailDomain, "MX")) {
//connect to database
include("includes/dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die("unable to connect to database");
$query="SELECT * FROM emails";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while($i<$num)
{
$date=date("F jS, Y");
$id=mysql_result($result,$i,"id");
$pos=mysql_result($result,$i,"pos");
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$suffix=mysql_result($result,$i,"suffix");
$street=mysql_result($result,$i,"street");
$suite=mysql_result($result,$i,"suite");
$csz=mysql_result($result,$i,"csz");
$email=mysql_result($result,$i,"email");
$name="$pos $first $last $suffix";
if (empty($suite))
{
$address="$street\n$csz";
}
else
{
$address="$street\n$suite\n$csz";
}
$fullmessage="$date\n\n$name\n$address\n\nDear $pos $last,\n$message";
if(mail($email,"Reguarding Tennessee's Current Catfish Regulations",$fullmessage,"From:$email1"))
{echo "$i";
}else{
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
die();
}
$i++;
}
echo "<br/>Thanks for your concern about the ongoing issue with the 34\" Catfish regulation.<br/>There have been ";
include("counter.php");
echo " emails sent to 131 people from this form.<br/>We Tennessee fisherman thank you for your contributions to the cause.";
}else {
echo "This email domain doesn't exist! Please enter a Valid Email Address.";
}
}else{
?><form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
Your Email: <input type="text" name="femail"><br><br>Comments<br>
<textarea name="fcomments" rows="30" cols="80">I’d like to offer my input about an on going effort to reverse Tennessee’s current maximum size limit regulation for catfish of 34 inches.
Commercial fishermen seem to be arguing that they have a meat market for these bigger fish, but it is believed they are selling them to operators of “pay lakes” in Illinois, Iowa and Ohio. Simply put, the fish of this size that they do sell are resources being taken from Tennessee sportsmen who buy licenses and sold to benefit sportsmen in other states!
Sport fishing for the larger, trophy catfish is a rapidly growing activity among sportsmen in states that have an abundance of them, and catfishing tournaments have become quite popular here adding important tourism dollars to our economy. Tennessee received national recognition in several major sporting magazines as the leader in this effort to protect the resource when our 34 - inch size restriction was enacted. These articles also spawned a lot of tourism dollars to our great state and now, other states near us, namely Arkansas, Virginia, Missouri, South Carolina, Oklahoma and Kentucky either have passed or are considering similar legislation.
Lastly, it is my understanding that the effort to overturn the current restriction is being made by a very small minority of commercial fishermen in our state. I urge you to help all Tennessee sport fishermen by voting against reversing this very important catfish size protection.
Sincerely,</textarea><br><br>
<input type="hidden" name="formsubmission">
<input type="submit" value="Submit">
</form>
<?
}
?></body>
</html>
I have 131 entries in the DB, and made all the email addresses the same, mine, for testing purposes.
When I submit the for $i echos 131 times, but I only recieve 9 emailssometime, sometimes I get none.
Something isn't right and I can't figure it out.
Help please,
Steve