Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [AJAX][PHP]Formularz kotnaktowy, jedna zmienna się nie przesyła
szikenen2
post 6.10.2010, 11:46:51
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 6.10.2010

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


Cześć,

mam problem z formularzem, otóż zmienna firma nie jest dostarczana na maila, sam napis Frima wyświetla się w nagłówku.
Byłbym wdzięczny winksmiley.jpg
kod wygląda tak:

kontakt.html:
  1. <form action="form-kontakt/contact.php" method="post" id="cForm">
  2. <div class="pole_kontaktu">
  3. <div class="pole_kontaktuin">Imię i nazwisko:</div>
  4. <input class="pole_kontaktu_input" type="text" = name="posName" id="posName" /></div>
  5. <div class="pole_kontaktu">
  6. <div class="pole_kontaktuin">Nazwa firmy:</div>
  7. <input class="pole_kontaktu_input" type="text" = name="firma" id="firma" /></div>
  8. <div class="pole_kontaktu">
  9. <div class="pole_kontaktuin">Email:</div>
  10. <input class="pole_kontaktu_input" type="text" = name="posEmail" id="posEmail" /></div>
  11. <div class="pole_kontaktu">
  12. <div class="pole_kontaktuin">Temat:</div>
  13. <select id="posRegard" class="pole_kontaktu_input" type="text" = name="posRegard">
  14. <option>Handel</option>
  15. <option>Transport</option>
  16. <option>Inne</option>
  17. </select>
  18. </div>
  19. <div class="pole_kontaktu">
  20. <div class="pole_kontaktuin">Treść:</div>
  21. <textarea class="pole_kontaktu_input" cols="36" rows="6" name="posText" id="posText"></textarea></div>
  22. <div class="pole_kontaktu">
  23. <p class="pole_kontaktu_w">
  24. <input class="wyslij" type="submit" name="sendContactEmail" id="sendContactEmail" value=" " />
  25. </p></div>
  26. </label>
  27. </form>


contact.php:
  1. include "config.php";
  2.  
  3. function cleanPosUrl ($str) {
  4. return stripslashes($str);
  5. }
  6. if ( isset($_POST['sendContactEmail']) )
  7. {
  8. $to = $yourEmail;
  9. $subject = $yourSubject.': '.$_POST['posRegard'];
  10. $subject .= $yourSubject.': '.$_POST['firma'];
  11. $message = cleanPosUrl($_POST['posText']);
  12. $headers = "From: ".cleanPosUrl($_POST['posName'])." <".$_POST['posEmail'].">\r\n";
  13. $headers .= 'To: '.$yourName.' <'.$yourEmail.'>'."\r\n";
  14. $mailit = mail($to,$subject,$message,$headers);
  15. if ( @$mailit ) {
  16. header('Location: '.$referringPage.'?success=true');
  17. }
  18. else {
  19. header('Location: '.$referringPage.'?error=true');
  20. }
  21. }



xmlHttpRequest:

  1. include "config.php";
  2.  
  3. header('Content-Type: text/xml');
  4. echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
  5.  
  6. echo '<resultset>';
  7.  
  8. function cleanPosUrl ($str) {
  9. $nStr = $str;
  10. $nStr = str_replace("**am**","&",$nStr);
  11. $nStr = str_replace("**pl**","+",$nStr);
  12. $nStr = str_replace("**eq**","=",$nStr);
  13. return stripslashes($nStr);
  14. }
  15. if ( $_GET['contact'] == true && $_GET['xml'] == true && isset($_POST['posText']) ) {
  16. $to = $yourName;
  17. $subject = 'Mail ze strony: '.cleanPosUrl($_POST['posRegard']);
  18. $subject .= 'Firma '.cleanPosUrl($_POST['firma']);
  19. $message = cleanPosUrl($_POST['posText']);
  20. $headers = "From: ".cleanPosUrl($_POST['posName'])." <".cleanPosUrl($_POST['posEmail']).">\r\n";
  21. $headers .= 'To: '.$yourName.' <'.$yourEmail.'>'."\r\n";
  22. $mailit = mail($to,$subject,$message,$headers);
  23.  
  24. if ( @$mailit )
  25. { $posStatus = 'OK'; $posConfirmation = 'Ok! Twój Email został wysłany.'; }
  26. else
  27. { $posStatus = 'NOTOK'; $posConfirmation = 'Twój Email nie mógł zostać wysłany. Spróbuj później.'; }
  28.  
  29. if ( $_POST['selfCC'] == 'send' )
  30. {
  31. $ccEmail = cleanPosUrl($_POST['posEmail']);
  32. @mail($ccEmail,$subject,$message,"From: Yourself <".$ccEmail.">\r\nTo: Yourself");
  33. }
  34.  
  35. echo '
  36. <status>'.$posStatus.'</status>
  37. <confirmation>'.$posConfirmation.'</confirmation>
  38. <regarding>'.cleanPosUrl($_POST['posRegard']).'</regarding>
  39. ';
  40. }
  41. echo' </resultset>';
  42.  

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 Wersja Lo-Fi Aktualny czas: 14.08.2025 - 00:57