Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]automatyczne wysyłanie formularza z wynikiem testu
Forum PHP.pl > Forum > Przedszkole
edina
Mam gotowy skrypt, który ma wysyłać automatycznie wynik testu na maila, ale nie chce tego robić.
Jest sugestia, aby robić to przez formmail.pl, ale to mi nie działa - może nie umiem go skonfigurować, bo to rozbudowany skrypt ohno-smiley.gif
Może jest prostszy sposób?
Nie umiem sobie poradzić, a bardzo mi na tym zależy, jeśli ktoś mógłby pomóc, byłabym wdzięczna

  1. var ResultForm = '<html><body><form name="Results" action="http://www.turmalin.cba.pl/cgi-bin/FormMail.pl" method="post" enctype="x-www-form-encoded">';
  2. ResultForm += '<input type="hidden" name="recipient" value="gp@turmalin.cba.pl"></input>';
  3. ResultForm += '<input type="hidden" name="subject" value="Zabawa"></input>';
  4. ResultForm += '<input type="hidden" name="Exercise" value="Zabawa"></input>';
  5. ResultForm += '<input type="hidden" name="realname" value=""></input>';
  6. ResultForm += '<input type="hidden" name="Score" value=""></input>';
  7. ResultForm += '<input type="hidden" name="Start_Time" value=""></input>';
  8. ResultForm += '<input type="hidden" name="End_Time" value=""></input>';
  9. ResultForm += '<input type="hidden" name="title" value="Thanks!"></input>';
  10. ResultForm += '<input type="hidden" name="bgcolor" value="#c0c0c0"></input>';
  11. ResultForm += '<input type="hidden" name="text_color" value="#008080"></input>';
  12. ResultForm += '<input type="hidden" name="sort" value="order:realname,Exercise,Score,Start_Time,End_Time"></input>';
  13. ResultForm += '<INPUT TYPE="SUBMIT" NAME="NAME" VALUE="Sprawdź"></input>';
  14. ResultForm += '</form></body></html>';
  15.  
  16. function GetUserName(){
  17. UserName = prompt('imi\u0119 i nazwisko:','');
  18. UserName += '';
  19. if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){
  20. UserName = prompt('imi\u0119 i nazwisko:','');
  21. UserName += '';
  22. if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){
  23. history.back();
  24. }
  25. }
  26. }
  27.  
  28. function SendResults(Score){
  29. var today = new Date;
  30. var NewName = '' + today.getTime();
  31. var NewWin = window.open('', NewName, 'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,,width=400,height=300');
  32.  
  33. //If user has prevented popups, no way to proceed -- exit
  34. if (NewWin == null){
  35. return;
  36. }
  37.  
  38. NewWin.document.clear();
  39. NewWin.document.open();
  40. NewWin.document.write(ResultForm);
  41. NewWin.document.close();
  42. NewWin.document.Results.Score.value = Score + '%';
  43. NewWin.document.Results.realname.value = UserName;
  44. NewWin.document.Results.End_Time.value = (new Date()).toLocaleString();
  45. NewWin.document.Results.Start_Time.value = StartTime;
  46. NewWin.document.Results.submit();
  47. }
b4rt3kk
Może użyj zwyczajnie funkcji mail? http://php.net/manual/en/function.mail.php

A w zamieszczonym fragmencie kodu ewidentnie czegoś brakuje.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.