Mail form, to = mails.txt ?

jacob

Registered
Здравейте, имам форма за пращане на мейли:

Код:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>EMIALER</title>
</head>
<body>
<form action="email.php" method="POST">
<table width="450" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>От: <input type="text" size="22" name="from"></td>
    <td>Тема:  <input type="text" size="22" name="subject"></td>
    <td>До: 
    <select name="group">
     <option selected="selected" value=""></option>
     <option value="1">Група 1</option>
     <option value="2">Група 2</option>
     <option value="3">Група 3</option>
    </select>
    </td>
  </tr>
  <tr>
    <td colspan="3"><textarea name="contents" rows="5" cols="51"></textarea></td>
  </tr>
  <tr>
    <td><input type="submit" name="B1" value="Изпрати"></td>
    <td><input type="reset" name="B2" value="Изчисти"></td>
  </tr>
</table>
</form>
</body>
</html>

email.php
Код:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mailer</title>
</head>
<body>
<?
$to = "$group";
$from_header = "From: $from";
if($contents != "")
{
   //send mail - $subject & $contents come from surfer input
   mail($to, $subject, $contents, $from_header);
   // redirect back to url visitor came from
   header("Location: $HTTP_REFERER");
}
  else
{
   print("<HTML><BODY>Попълнете полето за съдържание!");
   print("</BODY></HTML>");
}
?>
</body>
</html>

Как да направя така, че впредвид value на "group" за "to" да зарежда мейли от различни текстови файлове?
 

Back
Горе