Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [html+php] formularz i odebrana pusta wiadomość
nieraczek
post
Post #1





Grupa: Zarejestrowani
Postów: 405
Pomógł: 6
Dołączył: 12.01.2007

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


Po wypełnieniu pól formularza i kliknięciu przycisku "Wyślij" dochodzi do mnie wiadomość bez tematu i bez treści dlaczego ?
  1. ................................
  2. <script type="text/javascript">
  3.  
  4. function funkcja()
  5. {
  6. document.getElementById("imie_label").innerHTML="";
  7. document.getElementById("email_label").innerHTML="";
  8. document.getElementById("liczba_label").innerHTML="";
  9. var bledy=1; //deklaracja zmiennej: 0-błędy są; co 1-brak błędów
  10.  
  11. if(document.formularz.imie.value=="")
  12. {
  13. document.getElementById("imie_label").innerHTML="Wpisz imię.";
  14. bledy=0;
  15. }
  16.  
  17. if(document.formularz.email.value=="" || document.formularz.email.value.indexOf('@')==-1)
  18. {
  19. document.getElementById("email_label").innerHTML="Wpisz poprawny email.";
  20. bledy=0;
  21. }
  22.  
  23. if(document.formularz.liczba.value=="" || isNaN(document.formularz.liczba.value)==true)
  24. {
  25. document.getElementById("liczba_label").innerHTML="Wpisz liczbę.";
  26. bledy=0;
  27. }
  28.  
  29.  
  30. if (bledy==0) return false; //zwróć "false" a tym samym nie wysyłaj formularza
  31. else return true; //zwróć "true" a tym samym wyślij formularz
  32. }
  33. </head>
  34.  
  35. <noscript class="czerwien"> Włącz JavaScript </noscript>
  36. <form name="formularz" action="mail.php" method="post" onsubmit="return funkcja();">
  37.  
  38. <tr>
  39. <td>Wpisz imię</td>
  40. <td> <input type="text" name="imie" size="20" maxlength="20"/></td>
  41. <td class="czerwien"><label id="imie_label"></label></td>
  42. </tr>
  43.  
  44. <tr>
  45. <td>Wpisz email</td>
  46. <td> <input type="text" name="email" size="20" maxlength="20"/></td>
  47. <td class="czerwien"><label id="email_label"></label></td>
  48. </tr>
  49.  
  50. <tr>
  51. <td>Wpisz liczbę</td>
  52. <td> <input type="text" name="liczba" size="20" maxlength="20"/></td>
  53. <td class="czerwien"><label id="liczba_label"></label></td>
  54. </tr>
  55.  
  56. <tr>
  57. <td><input type="submit" name="wyslij" value="Wyślij"/></td>
  58. </tr>
  59.  
  60. </form>
  61.  
  62.  
  63. </body>
  64. </html>


dokument "mail.php":
  1. <?php
  2.  
  3. mail("xxxxxxx@wp.pl", $imie, $liczba);
  4.  
  5. ?>
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 19.08.2025 - 05:42