Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Formularz zgłoszeniowy, nie przesyła/pobiera danych
kafar610
post
Post #1





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 13.01.2013
Skąd: Pruszków

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


Witam
Mam problem z moim małym skrypcikiem bo nie pobiera mi niektorych danych, bierze tylko numer telefonu i email, i nie wiem czemu.
Prosze o wyrozumiałość gdyż jestem świeżakiem (IMG:style_emoticons/default/biggrin.gif)
  1. <?php
  2.  
  3. $email_to = "kafar610@gmail.com";
  4. $email_subject = "Your email subject line";
  5.  
  6. $first_name = $_POST['firstname'];
  7. $last_name = $_POST['lastname'];
  8. $email = $_POST['email'];
  9. $telephone = $_POST['telephone'];
  10. $other = $_POST['other'];
  11.  
  12. $msg = "Imię: $firstname\n" .
  13. "Nazwisko: $last_name\n" .
  14. "email: $email\n" .
  15. "telephone: $telephone\n" .
  16. "Inne komentarze: $other";
  17.  
  18. $headers = 'From: ' . $_POST['email'] . "\r\n" .
  19. 'Content-type: text/html; charset=utf-8';
  20.  
  21. mail($email_to, $email_subject, $msg, $headers);
  22. echo 'Wszystko ok';
  23.  
  24. ?>


  1. <form name="contactform" method="post" action="report.php">
  2.  
  3. <table width="750px" cellspacing="10">
  4.  
  5. <tr>
  6.  
  7. <td valign="top">
  8.  
  9. <label for="firstname">Imię: *</label>
  10.  
  11. </td>
  12.  
  13. <td valign="top">
  14.  
  15. <input type="text" id="firstname" name="firstname" />
  16.  
  17. </td>
  18.  
  19. </tr>
  20.  
  21. <tr>
  22.  
  23. <td valign="top">
  24.  
  25. <label for="last_name">Nazwisko *</label>
  26.  
  27. </td>
  28.  
  29. <td valign="top">
  30.  
  31. <input type="text" name="last_name" maxlength="50" size="30">
  32.  
  33. </td>
  34.  
  35. </tr>
  36.  
  37. <tr>
  38.  
  39. <td valign="top">
  40.  
  41. <label for="email">Adres e-mail *</label>
  42.  
  43. </td>
  44.  
  45. <td valign="top">
  46.  
  47. <input type="text" name="email" maxlength="80" size="30">
  48.  
  49. </td>
  50.  
  51. </tr>
  52.  
  53. <tr>
  54.  
  55. <td valign="top">
  56.  
  57. <label for="telephone">Numer telefonu</label>
  58.  
  59. </td>
  60.  
  61. <td valign="top">
  62.  
  63. <input type="text" name="telephone" maxlength="30" size="30">
  64.  
  65. </td>
  66.  
  67. </tr>
  68.  
  69. <tr>
  70.  
  71. <td valign="top">
  72.  
  73. <label for="other">Pytania, uwagi *</label>
  74.  
  75. </td>
  76.  
  77. <td valign="top">
  78.  
  79. <textarea name="msg" maxlength="1000" cols="25" rows="6"></textarea>
  80.  
  81. </td>
  82.  
  83. </tr>
  84.  
  85. <tr>
  86.  
  87. <td colspan="2" style="text-align:center">
  88.  
  89. <input type="submit" value="Submit">
  90.  
  91. </td>
  92.  
  93. </tr>
  94.  
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kafar610
post
Post #2





Grupa: Zarejestrowani
Postów: 51
Pomógł: 0
Dołączył: 13.01.2013
Skąd: Pruszków

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


ma ktoś pomysł jak rozwiązać problem kodowania? bo zrobiłem coś takiego, kodowanie działa lecz niestety nie pokazuje nadawcy nie wiem czemu, pokazuje że nadawca jest nieznany...

  1. <?php
  2. if (isset($_POST['submit'])) {
  3. $output_form = false;
  4.  
  5. $headers = array();
  6. $headers[] = "MIME-Version: 1.0";
  7. $headers[] = "Content-type: text/plain; charset=utf-8";
  8. $headers[] = "From: $email";
  9.  
  10. $email_to = "kafar610@gmail.com";
  11. $email_subject = "Your email subject line";
  12.  
  13. $nick = $_POST['nick'];
  14. $email = $_POST['email'];
  15. $telephone = $_POST['telephone'];
  16. $other = $_POST['other'];
  17.  
  18.  
  19.  
  20. if (empty($nick)) {
  21. echo 'nie podałeś imienia i nazwiska<br />';
  22. $output_form = true;
  23. }
  24.  
  25. if (empty($email)) {
  26. echo 'nie podałeś emaila<br />';
  27. $output_form = true;
  28. }
  29.  
  30. if (empty($other)) {
  31. echo 'nie zadałeś pytania<br />';
  32. $output_form = true;
  33. }
  34. }
  35.  
  36. if ((!empty($nick)) && (!empty($email)) && (!empty($other))) {
  37.  
  38. $msg = "Imię i nazwisko: $nick\n" .
  39. "Telefon: $telephone\n" .
  40. "Pytania, uwagi: $other";
  41. mail($email_to, $email_subject, $msg, implode("\r\n", $headers));
  42. echo 'Wysłano e-mail, dziękujemy <br />';
  43. }
  44.  
  45. else{
  46. $output_form = true;
  47. }
  48.  
  49. if ($output_form) { // sprawdza wartosc zmiennej $output_form jesli true to wyswietla formularz
  50. ?>
  51.  
  52. <form name="contactform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  53. <table width="750px" cellspacing="10">
  54. <tr>
  55. <td valign="top">
  56. <label for="nick">Imię i nazwisko <font color="red">*</font></label>
  57. </td>
  58. <td valign="top">
  59. <input type="text" name="nick" maxlength="50" value="<?php echo $nick; ?>" size="30">
  60. </td>
  61. </tr>
  62. <tr>
  63. <td valign="top">
  64. <label for="email">Adres e-mail <font color="red">*</font></label>
  65. </td>
  66. <td valign="top">
  67. <input type="text" name="email" maxlength="80" value="<?php echo $email; ?>" size="30">
  68. </td>
  69. </tr>
  70. <tr>
  71. <td valign="top">
  72. <label for="telephone">Numer telefonu</label>
  73. </td>
  74. <td valign="top">
  75. <input type="text" name="telephone" maxlength="30" value="<?php echo $telephone; ?>" size="30">
  76. </td>
  77. </tr>
  78. <tr>
  79. <td valign="top">
  80. <label for="other">Pytania, uwagi <font color="red">*</font></label>
  81. </td>
  82. <td valign="top">
  83. <textarea name="other" maxlength="1000" cols="25" rows="6"><?php echo $other; ?></textarea>
  84. </td>
  85. </tr>
  86. <tr>
  87. <td colspan="2" style="text-align:center">
  88. <input type="submit" name="submit" value="Submit">
  89. </td>
  90. </tr>
  91. </table>
  92. </form>
  93.  
  94. <?php
  95. }
  96.  
  97. ?>


Ten post edytował kafar610 27.03.2014, 14:46:28
Go to the top of the page
+Quote Post

Posty w temacie


Closed TopicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 10.10.2025 - 20:52