I have some code that looks like this:
<?php
$totalnumberofinputs = 26;
$to = "chrisleon@nicholasandco.com";
$from = "nicholas@nicholasandco.com";
for($i=1; $i<=$totalnumberofinputs; $i++) {
${"sum".$i} = ${"allow".$i} - "${"amount".$i}";
if (${"amount".$i} <= ${"allow".$i}){
${"sum".$i} = 0;}
else{
${"sum".$i} = ${"allow".$i} - "${"amount".$i}";
}
print ("<tr align=\"middle\">\n".
"<td width=\"100\">${"emp".$i}</td>\n".
"<td width=\"200\">${"name".$i}</td>\n".
"<td width=\"100\">${"allow".$i}</td>\n".
"<td width=\"100\">${"amount".$i}</td>\n".
"<td width=\"100\">${"sum".$i}</td>\n".
"</tr>\n");
}
I would like to mail this code to selected individuals, but, if I put the mail(); in the for statement, it sends a the same mail 26 times, but if I put it outside the for statement, I can not get the values for $i to increment in the mail unfortunately. So, I know that in perl, you can OPEN MAIL, outside a for, and then call MAIL ${"emp".$i} inside the for, and close the mail outside the for. I know I am being redundant, but does php offer something similar? please help, I am extremely new at this.
thanx