Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Pierwszy formularz.
marian2299
post
Post #1





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

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


Jak wstawić do formularza, by wypełniający dodawał plik (tylko i wyłącznie!) mp3, na serwer, a potem wysyłał w załączniku razem z innymi danymi na maila?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
marian2299
post
Post #2





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

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


  1. <?php
  2. $imie=$_POST['imie'];
  3. $nazwisko=$_POST['nazwisko'];
  4. $email=$_POST['email'];
  5. $gg=$_POST['gg'];  
  6. $pseudonim=$_POST['pseudonim'];
  7. $ulica=$_POST['ulica'];
  8. $miasto=$_POST['miasto'];
  9. $wiek=$_POST['wiek'];
  10. $probkaglosu=$_POST['probkaglosu'];
  11. $uwagi=$_POST['uwagi'];
  12.  
  13. require("phpmailer/class.phpmailer.php");
  14. $mail = new PHPMailer();
  15.  
  16. $mail->PluginDir = "phpmailer/";
  17. $mail->From = "maxior-zgierz@o2.pl"; //adres naszego konta
  18. $mail->FromName = "Mail";//nagłówek From
  19. $mail->Host = "poczta.o2.pl";//adres serwera SMTP
  20. $mail->Mailer = "smtp";
  21. $mail->Username = "maxior-zgierz";//nazwa użytkownika
  22. $mail->Password = "HASŁOTUTAJ (IMG:http://forum.php.pl/style_emoticons/default/haha.gif) ";//nasze hasło do konta SMTP
  23. $mail->SMTPAuth = true;
  24. $mail->SetLanguage("pl", "phpmailer/language/");
  25.  
  26. $mail->Subject = "Rekrutacja";//temat maila
  27.  
  28. // w zmienną $text_body wpisujemy treść maila
  29. $text_body = "Imię: $imie \nNazwisko: $nazwisko \nE-mail: $emal \nNumer gg: $gg \nPseudonim: $pseudonim \nUlica,plac, aleja: $ulica \nMiasto: $miasto \nWiek: $wiek \nPróbka głosu: $probkaglosu \nDodatkowe uwagi: $uwagi ";
  30.  
  31. $mail->Body = $text_body;
  32. // adresatów dodajemy poprzez metode 'AddAddress'
  33. $mail->AddAddress("marianex@gery.pl","Prezes");
  34.  
  35.  
  36. if(!$mail->Send())
  37. echo "Wystąpił błąd z mailem<br>";
  38. echo $mail->ErrorInfo."<br>";
  39.  
  40. // Clear all addresses and attachments
  41. $mail->ClearAddresses();
  42. $mail->ClearAttachments();
  43. echo "mail wysłany<br>";
  44.  
  45. ?>
  46.  
  47.  
  48.  
  49. <form enctype="multipart/form-data"  action="formularz.php"  method="post" accept="audio/mpeg">
  50. <table width="520" cellpadding="5" cellspacing="0">
  51. <tr >
  52.  <td width="150" class="left" >
  53.   <label >Imię </label>
  54.  </td>
  55.  <td class="right" >
  56.   <input type="text" size="20" name="imie"  value="" maxlength="100" maxsize="100" />
  57.  
  58.  </td>
  59. </tr>
  60. <tr >
  61.  <td width="150" class="left" >
  62.   <label >Nazwisko </label>
  63.  </td>
  64.  <td class="right" >
  65.   <input type="text" size="20" name="naziwsko"  value="" maxlength="100" maxsize="100" />
  66.  
  67.  </td>
  68. </tr>
  69. <tr >
  70.  <td width="150" class="left" >
  71.   <label >E-mail </label>
  72.  </td>
  73.  <td class="right" >
  74.   <input type="text" size="20" name="email"  value="" maxlength="100" maxsize="100" />
  75.  
  76.  </td>
  77. </tr>
  78. <tr >
  79.  <td width="150" class="left" >
  80.   <label >Numer gadu-gadu </label>
  81.  </td>
  82.  <td class="right" >
  83.   <input type="text" size="20" name="gg"  value="" maxlength="10" maxsize="10" />
  84.  
  85.  </td>
  86. </tr>
  87. <tr >
  88.  <td width="150" class="left" >
  89.   <label >Pseudonim </label>
  90.  </td>
  91.  <td class="right" >
  92.   <input type="text" size="20" name="pseudonim"  value="" maxlength="100" maxsize="100" />
  93.  
  94.  </td>
  95. </tr>
  96. <tr >
  97.  <td width="150" class="left" >
  98.   <label >Ulica/Plac/Aleja </label>
  99.  </td>
  100.  <td class="right" >
  101.   <input type="text" size="20" name="ulica"  value="" maxlength="100" maxsize="100" />
  102.  
  103.  </td>
  104. </tr>
  105. <tr >
  106.  <td width="150" class="left" >
  107.   <label >Miasto </label>
  108.  </td>
  109.  <td class="right" >
  110.   <input type="text" size="20" name="miasto"  value="" id="q4"    maxlength="100" maxsize="100" />
  111.  
  112.  </td>
  113. </tr>
  114. <tr >
  115.  <td width="150" class="left"  valign="top" >
  116.   <label>Wiek </label>
  117.  </td>
  118.  <td class="right">
  119.   <select class="other" name="wiek">
  120.  
  121.  <option></option>
  122.    <option>16</option>
  123.    <option>17</option>
  124.    <option>18</option>
  125.    <option>19</option>
  126.    <option>20</option>
  127.  
  128.    <option>21</option>
  129.    <option>22</option>
  130.    <option>23</option>
  131.    <option>24</option>
  132.    <option>25</option>
  133.    <option>26</option>
  134.  
  135.    <option>27</option>
  136.    <option>28+</option>
  137.   </select>
  138.  </td>
  139. </tr>
  140. <tr >
  141.  <td width="150" class="left" >
  142.     <label>Próbka głosu, w któłrej mółwisz, czemu chcesz u nas grać? </label>
  143.  
  144.  </td>
  145.  <td class="right">
  146.     <input type="file"  size="20" name="probkaglosu" />
  147.  </td>
  148. </tr>
  149. <tr >
  150.  <td width="150" class="left" valign="top"  >
  151.   <label>Dodatkowe uwagi</label>
  152.  
  153.  </td>
  154.  <td class="right" >
  155.   <textarea cols="35" rows="10" name="uwagi"  id="q7" ></textarea>
  156.  </td>
  157. </tr>
  158. <tr >
  159.  <td width="150" class="left" >&nbsp;
  160.  
  161.  </td>
  162.  
  163.  <td class="right">
  164.  <input type="submit" value="Submit" />
  165. </td>
  166. </tr>
  167. </table>
  168. </div>
  169. </div>
  170. </form>

Wysyła mail, bez załącznika, czytałem że najpierw trzeba uploadować plik na serwer i wstawić przez AddAttachment, ale jak wstawić, skoro kazdy dodaje inną próbkę?
Cały czas pokazuje "mail wysłany" czemu ?
I dostaje 2 maile ciągle, czemu ?
Go to the top of the page
+Quote Post

Posty w temacie
- marian2299   [PHP]Pierwszy formularz.   16.07.2009, 20:10:48
- - erix   Sprawdzasz MIME, wysyłasz przez phpMailer.   16.07.2009, 20:11:34
- - marian2299   Napisałem: [PHP] pobierz, plaintext <?php$wysl...   16.07.2009, 21:28:45
- - ArekJ   Ale wysyłaj to przez PHPMailer a nie funkcję mail(...   16.07.2009, 21:44:48
- - marian2299   [PHP] pobierz, plaintext <?php$imie=$_POST...   17.07.2009, 11:03:31
- - kajzur   Mail wysłany jest zwykłym echem, więc będzie zawsz...   17.07.2009, 11:08:45
- - marian2299   Teraz ok ? [PHP] pobierz, plaintext <?phpif...   17.07.2009, 11:29:57
- - erix   A ciężko sprawdzić...?   17.07.2009, 12:06:03
- - marian2299   Wiecie co? Nie chcę się bawić w załącznik. Chciałb...   17.07.2009, 12:17:34
- - erix   PHP - kurs: wysyłanie plików. To naprawdę nie jest...   17.07.2009, 12:22:46
- - marian2299   To jest zgłoszenie do pracy w radiu. Jest imię, ps...   17.07.2009, 12:42:56
- - erix   CytatJak zmienić nazwę pliku na "probka-1...   17.07.2009, 12:45:33
- - marian2299   A jak `zapisać sobie ostatni identyfikator...   17.07.2009, 12:48:33
- - erix   A co z zapisem danych do pliku? Przecież napisał...   17.07.2009, 12:53:58
- - marian2299   [PHP] pobierz, plaintext <?php // zmienna ...   17.07.2009, 13:05:04
- - erix   A ciężko spróbować? Radź sobie trochę...   17.07.2009, 13:07:27
- - marian2299   Dobra mam tak: [PHP] pobierz, plaintext <?php...   17.07.2009, 13:18:23
- - Marcuez   Zainspirowałeś mnie tym problemem i jestem w stani...   17.07.2009, 19:56:11


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: 11.10.2025 - 15:36