Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP] Co zrobić żeby zmienna z pola select się nie pojawiała w przychodzącym mejlu?
alano
post
Post #1





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 16.03.2009

Ostrzeżenie: (0%)
-----


Witam,

Dodałem do formularza nowe pole select, zrobiłem tak żeby zależnie od wybranej np. osoby mejl szedł do przypisanego jej mejla i wygląda to jak poniżej, ale problem jest taki że na mejla mi przychodzi oprocz podanego imienia i telefonu wartosci z pola select tj. "recipient - > Tomek", a tego nie chcę. Co zrobić(IMG:style_emoticons/default/questionmark.gif) ?

  1. <form name="New_Form" action="formtoemail.php" method="post" enctype="application/x-www-form-urlencoded" onsubmit="return New_Form_CF();">
  2. <p class='formtext'>Imię:</p><input type="text" name="Imię" value="" maxlength="55" style="width: 240px" />
  3. <p class='formtext'>Telefon (max. 9 cyfr):</p><input type="text" name="Telefon" value="" maxlength="9" style="width: 240px" />
  4. <div align="left" style="padding-left: 6px; padding-top: 6px;"><input type="submit" id="button" value="Wyślij" /></div>
  5.  
  6. <select name="recipient">
  7. <option value="">Wybierz osobę</option>
  8. <option value="recipient_1">Tomek</option>
  9. <option value="recipient_2">Jacek</option>
  10. <option value="recipient_3">Paweł</option>
  11.  
  12. </form>


  1. while (@list($var,$val) = @each($_POST)) {
  2. if (is_array($val)){
  3. $temp = '';
  4. foreach($val as $newval){
  5. $temp .= "$newval ";
  6. }
  7. $message .= "$var: $temp\n";
  8. } else {
  9. $message .= "$var: $val\n";
  10. }
  11. }
  12.  
  13. $recipients = array(
  14.  
  15. 'recipient_1' => 'asz0988@hotmail.com',
  16. 'recipient_2' => 'aszestakowski@gmail.com',
  17. 'recipient_3' => 'aszestakowski@gmail.com'
  18.  
  19. );
  20.  
  21. $your_email = $recipients[$_REQUEST['recipient']];
  22.  
  23. // send the email
  24. mail($your_email, $subject, $message, "From: $name <$email>\nMIME-Version: 1.0\nContent-type: text/html; charset=UTF-8");
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 23:13