//File: index.php
<html>
<head>
<title></title>
</head>
<body>
<?
$form = "<form action=\"index.php\" method=\"post\">
<input type=\"hidden\" name=\"seenform\" value=\"y\">
Your Email:<br>
<input type=\"text\" name=\"email\" value=\"\"><br>
<input type=\"checkbox\" name=\"information[team]\" value=\"y\">Development
Team<br>
<input type=\"checkbox\" name=\"information[events]\" value=\"y\">Upcoming
Events<br>
<input type=\"submit\" value=\"send\">
</form>";
if ($seenform != "y") :
print "$form";
else :
$headers = "From: d@yoursite.com";
while ( list($key, $val) = each ($information) ) :
if ($val == "y") :
$filename = "$key.txt";
$subject = "Requested $key information";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
mail($email, $subject, $contents, $headers) or die("Can't send email!");
fclose($fd);
endif;
endwhile;
print sizeof($information)." newsletters have been sent to $email!";
endif;
?>
</body>
</html>
|