Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. <html>
  2.     <body>
  3.         <form method="POST">
  4.             <select name="maakond">
  5.                 <option value="1">Tartu maakond</option>
  6.                 <option value="2">Pärnu maakond</option>
  7.                 <option value="3">Harju maakond</option>
  8.                 <option value="4">Ida-viru maakond</option>
  9.             </select>
  10.             <input type="submit" value="OK" />
  11.         </form>
  12.     </body>
  13. </html>
  14.  
  15. <?php
  16.  
  17. // Seaded - emailid
  18.  
  19. $tartuMaakond = Array("email@email.ee", "email2@email.ee");
  20. $parnuMaakond = Array("email@email.ee", "email2@email.ee");
  21. $harjuMaakond = Array("email@email.ee", "email2@email.ee");
  22. $idaMaakond = Array("email@email.ee", "email2@email.ee");
  23.  
  24.  
  25. // Seaded - emaili saaja näeb saatjana keda?
  26.  
  27. $headers = 'From: <webmaster@example.com>' . "\r\n";
  28.  
  29. if ($_POST)
  30. {
  31.     if (isset($_POST['maakond']))
  32.     {
  33.         $maakond = $_POST['maakond'];
  34.        
  35.         switch ($maakond)
  36.         {
  37.             case 1:
  38.             {
  39.                 // Send email to tartuMaakond
  40.                 for($i = 0; $i <= count($tartuMaakond) - 1; $i++)
  41.                 {
  42.                     //send_email_func()
  43.                    
  44.                     // Test output
  45.                     print ("Tartu: mail to=>" . $tartuMaakond[$i] . "<br>");
  46.                 }
  47.                 break;
  48.             }
  49.             case 2:
  50.             {
  51.                 // Send email to parnuMaakond
  52.                 for($i = 0; $i <= count($parnuMaakond) - 1; $i++)
  53.                 {
  54.                     //send_email_func()
  55.                    
  56.                     // Test output
  57.                     print ("Pärnu: mail to=>" . $parnuMaakond[$i] . "<br>");
  58.                 }
  59.                 break;
  60.             }
  61.             case 3:
  62.             {
  63.                 // Send email to harjuMaakond
  64.                 for($i = 0; $i <= count($harjuMaakond) - 1; $i++)
  65.                 {
  66.                     //send_email_func()
  67.                    
  68.                     // Test output
  69.                     print ("Harju: mail to=>" . $harjuMaakond[$i] . "<br>");
  70.                 }
  71.                 break;
  72.             }
  73.             case 4:
  74.             {
  75.                 // Send email to idaMaakond
  76.                 for($i = 0; $i <= count($idaMaakond) - 1; $i++)
  77.                 {
  78.                     //send_email_func()
  79.                    
  80.                     // Test output
  81.                     print ("Ida: mail to=>" . $idaMaakond[$i] . "<br>");
  82.                 }
  83.                 break;
  84.             }
  85.         }
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement