$form = "
";
if ($seenform != "y") :
print "$form";
else :
$headers = "From: devteam@yoursite.com";
// Перебрать все пары "ключ/значение"
while ( list($key, $val) = each ($information) ) :
// Сравнить текущее значение с "y"
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)." informational newsletters have been sent to $email!";
endif;
?>