Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php] w formularzach flash i html (problem)
Forum PHP.pl > Forum > Przedszkole
RHplus
Na początku witam bo to mój pierwszy post na tym forum i od razu pisze z problemem

Problem 1) mam flashową stronkę ( www.photoRHplus.com )z formularzem
(pola formularza nazywają się t11, t12 itd, w którym miejscu powinienem zmienić dane w php?)
  1. <?php
  2. if(!empty($_POST['imie'])
  3. || !empty($_POST['nazwa'])
  4. || !empty($_POST['email'])
  5. || !empty($_POST['telefon'])
  6. || !empty($_POST['fax'])
  7. || !empty($_POST['email2'])
  8. || !empty($_POST['tresc']))
  9. {
  10.  
  11. // tworzymy krotkie nazwy zmiennych odbieranych z Flash
  12. $imie = $_POST['imie'];
  13. $nazwa = $_POST['nazwa'];
  14. $email = $_POST['email'];
  15. $telefon = $_POST['telefon'];
  16. $fax = $_POST['fax'];
  17. $email2 = $_POST['email2'];
  18. $tresc = $_POST['tresc'];
  19.  
  20. // w zmiennej $to zapisujemy adres gdzie formularz mialby byc wysylny
  21. $to = 'office@photorhplus.com';
  22.  
  23. //przetwarzamy dane formularza i wysylamy na wczesniej definiowany adres mail
  24. $nazwa = stripslashes($nazwa);
  25. $telefon = stripslashes($telefon);
  26. $fax = stripslashes($fax);
  27. $email2 = stripslashes($email2);
  28. $tresc = stripslashes($tresc);
  29. $body = $imie;
  30. $body = $telefon;
  31. $body = $fax;
  32. $body = $email2;
  33. $body = $tresc;
  34. $body .= "rn_____________________________________________________rn";
  35. $body .= "Mail wyslany przez : ".nazwa." [".$email."]";
  36.  
  37. if(@mail($to, $nazwa, $body))
  38. {
  39. // zaleznie od tego czy wyslanie maila powiodlo sie wysylamy odpowiednia odpowiedz
     do Flash
  40. echo "odpowiedz=WYSLANIE FORMULARZA POWIODLO SIE...&";
  41. } else {
  42. echo "odpowiedz=WYSTAPIL BLAD PODCZAS WYSYLANIA MAIL...&";
  43. }
  44. }
  45. ?>



dalej (już we flashu) na przycisku "submit" mam wklepane:

  1. <?php
  2. on (release) {
  3. formularz.sendAndLoad("formularz.php", formularz, "POST");
  4. }
  5. ?>




jak widać na stronie pisze "oczekiwanie na odpowiedź serwera" i wiadomość nie jest wysyłana (mam wykupione konto na webd.pl więc php jest obsługiwane), co może być jeszcze przyczyną questionmark.gif?



Problem 2) na stronie znajduje się też formularz html (pod adresem http://www.photorhplus.com/formularz/inc/form.html )
i pytanie jak stworzyć do niego skrypt php który będzie pozwalał na wysyłanie przez ten formularz plików
mam coś takiego i nie bardzo radzi sobie z wyłaniem plików i wysyłaniem informacji która odpowiedź była zaznaczona w ankiecie

  1. <?
  2.  
  3.  // Names of the HTML header and footer files.
  4.  $incHeader = $phpMailRoot."inc/header.html";
  5.  $incFooter = $phpMailRoot."inc/footer.html";
  6.  
  7.  // Name of the file to include for the HTML form.
  8.  $incForm = $phpMailRoot."inc/form.html";
  9.  
  10.  // Name of the file to include for the welcome page.
  11.  $incWelcome = $phpMailRoot."inc/welcome.html";
  12.  
  13.  // Name of the file to include for missing required fields.
  14.  $incMissing = $phpMailRoot."inc/missing.html";
  15.  
  16.  // Name of the file to include for a bad email address.
  17.  $incBadEmail = $phpMailRoot."inc/bad_mail.html";
  18.  
  19.  // Name of the file to include for thanking the user.
  20.  $incThanks = $phpMailRoot."inc/thanks.html";
  21. // Define main variables
  22.  
  23.  // Who the mail should go to. Leaving undefined skips send (log/autoreply only)
  24.  $defTo = "models@photorhplus.com";
  25.  
  26.  // Which values need to be input in form.
  27.  $defRequired = "imie,nazwisko,email,telefon";
  28.  
  29.  // Should we do a test for a valid from address?
  30.  // Note: even with this turned off, the script will not
  31.  // send an autoreply to an invalid address. Also, if from
  32.  // is not a required field, it will not be checked.
  33.  $defCheckemail = 1;
  34.  
  35.  // The subject the sent mail should have.
  36.  $defSubject = "Zgloszenie modelki";
  37.  
  38.  
  39.  $defTemplate = "Tresc Formularza.n Dane modelki:nn"
  40.  
  41. ."Imie: %imie%n
  42. Nazwisko: %nazwisko%n
  43. email: %email%n
  44. wiek: %wiek%n
  45. wzrost: %wzrost%n
  46. biust talia biodra: %biust% %talia% %biodra%n
  47. Adres zamieszkania: %adres%n
  48. Telefon: %telefon%n
  49. GG: %gg% Skype: %skype%n
  50. Dyspozycyjnosc: %portret%n%moda%n%bielizna%n%nagosc zakryta%n%topless%%akt%n
  51. Dodatkowe: %info%n
  52. Pliki: %file1%n%file2%n%file3%n%file4%n%file5%";
  53.  
  54.  // Who it should appear to be from. Leave commented
  55.  // out if you don't want to allow empty from lines.
  56.  // $defFrom = "webuser@here.com";
  57.  
  58.  // Who the autoreply should appear to be from. Leave
  59.  // commented out if you want to maintain 1.0 compatibility.
  60.  // If defTo is undefined (i.e. you only want to log the mail)
  61.  // you can still have an autoreply by defining this variable
  62.  // and the autoreply variable.
  63.  $defAutoemail = "%email%";
  64.  
  65.  // The subject the autoreply should have. Comment it
  66.  // out if you want to maintain 1.0-style autoreply subjects.
  67.  $defAutosubject = "Thank you for visiting!";
  68.  
  69.  // A prefix to the subject of autoreply messages. If
  70.  // left undefined, will default to "Auto-Reply: "
  71.  // Will not be used if "autosubject" is defined
  72.  // $defAutoprefix = "Re: ";
  73.  
  74.  // Any extra headers for the autoreply. Don't forget the n
  75.  // between them!
  76.  // $defAutoextras = "Reply-To: realperson@here.comnErrors-To:me@here.comn";
  77.  
  78.  // The body template for the autoreply.
  79.  //  ie. %firstname% is used to print the value of the form element named firstname
  80.  $defAutoreply = "Hi %imie% %nazwisko%!nn"
  81. ."  Thank you very much for taking the time to contact me!n"
  82. ."  Below is a summary of what you sent to me:nn"
  83. ."t%firstname% %lastname%nt%email%nt%street%nt%city%nt"
  84. ."%province%nt%postal%nt%country%nt%comments%n"
  85. ."nnn"
  86. ."ttttYours Sincerely,nn"
  87. ."tttt  Webmaster";
  88.  
  89.  // Ask user for a second submission on completion?
  90.  // (Only works for "normal" version)
  91.  $defAskagain = 0;
  92.  
  93.  // Text to output when asking for another submission
  94.  $defAsktext = "<BR>Please send another message if you wish.<BR>";
  95.  
  96.  
  97. // Define varibles needed for database access (logging)
  98.  
  99.  // Do logging?
  100.  $defLog = 0;
  101.  
  102.  // Log bodies?
  103.  $defLogbodies = 0;
  104.  
  105.  // MySQL hostname
  106.  $db_hostname = "";
  107.  
  108.  // MySQL username
  109.  $db_user = "";
  110.  
  111.  // MySQL password
  112.  $db_password = "";
  113.  
  114.  // MySQL database name
  115.  $db_database = "";
  116.  
  117.  // MySQL table name
  118.  $db_table = "maillog";
  119.  
  120.  
  121. // Some system values. These shouldn't normally need
  122. // to be changed.
  123.  
  124.  // Define common library
  125.  $library = $phpMailRoot."lib/common.lib";
  126.  
  127.  // Define method of finding self_name
  128.  // Only change this if ACTION="" is showing up in
  129.  // your forms instead of action="index.php3"
  130.  $whoami = basename(getenv("PATH_INFO"));
  131.  
  132.  // Toggle whether to display some debugging info.
  133.  // Turn off after testing your configuration.
  134.  $debug = 0;
  135.  
  136. ?>


Z góry dzięki za odpowiedź
Pozdrawiam
manitou
łatwo skopiować szablonik flash , gorzej z przerobieniem go tongue.gif

Do rzeczy , masz spory problem , bo z tego co piszesz to sie na niczym nieznasz smile.gif

do flasha polecam www.flashzone.pl
php - zostaw w spokoju
MySQL - również
Zacznij od kursu htmla smile.gif

Pozdrawiam
Chciałem pomóc .
RHplus
to moja strona i fakt, nie mam zielonego pojęcia o Flashu/php i htmlu dlatego tu napisałem, bo nie potrafię rozwiązać tego problemu i liczę na jakąś radę, jak sobie z tym poradzić.
manitou
( pokażę ci wersję skróconą twojego formularza, odwołuje sie tylko do : podaj imię , mail i wpisz teść wiadomości )

Zaczynając od Flasha na przycisku "submit" wstaw w AS to :
Zmień te t11, t12 , na normalny opis , tam gdzie ma być imię , wpisz "imie" później "email" i "wiadomosc" .

ActionScript :
//////////////////////////////////////////////////////////////////
on (release)
{
if (!imie.length)
{
jestem_glupi = "Proszę wpisać Imię do jasnej ciasnej smile.gif";
}
else if (!Email.length || email.indexOf("@") == -1 || Email.indexOf(".") == -1)
{
jestem_glupi = "Proszę wpisać prawidłuwy adres e-mail";
}
else if (!wiadomosc.length)
{
jestem_glupi = "Proszę wpisać wiadomość";
}
else
{
loadVariablesNum("plik_z_kodem_php_.php", 0, "POST");

gotoAndPlay(2); //w drugiej klatce możesz zrobić coś w stylu : dzięki za maila .
} // no i koniec naszego ifa
}

//////////////////////////////////////////////////////////


Zrób "dynamic text " i nazwij go "jestem_glupi" smile.gif tu bedą sie wyświetlać komunikaty .


stwórz nowy plik w notatniku nazwij go plik_z_kodem_php.pl
a w nim :


  1. <?php
  2. $imie = iconv("UTF-8", "ISO-8859-2", $_POST['imie']);
  3. $email = $_POST['email'];
  4. $wiadomosc = iconv("UTF-8", "ISO-8859-2", $_POST['wiadomosc']);
  5.  
  6. $ToEmail = "jakis_mail@ooo.pl";
  7. $ToSubject = "MAIL ZE STRONY WWW";
  8. $EmailBody = "IMIE I NAZWISKO: $imiennWIADOMOSC:n$wiadomoscn";
  9. mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, "DANE ADRESOWE: ".$email.">");
  10. ?>


To tyle na temat Flash<->php piszene na szybko ........ chyba niema błędów niesprawdzałem .

pozdro
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.