[PHP][JavaScript] Błąd w wysyłaniu danych z formularza

0

Witam, mam problem z wysłaniem formularza, alert o wysłaniu się pojawia ale skrzynka jest pusta. Może mi ktoś powiedzieć co jest nie tak? Siedzę już nad tym kilka godzin i ni w ząb mi nie idzie.

Kod pliku wysyłającego(check.php):

<?php
	$recordClientNameFirst = $_POST['recordClientNameFirst'];
	$recordClientNameLast = $_POST['recordClientNameLast'];
	$recordClientAddress1 = $_POST['recordClientAddress1'];
	$recordClientAddress2 = $_POST['recordClientAddress2'];
	$recordClientCity = $_POST['recordClientCity'];
	$recordPurchaseMetRealtor = $_POST['recordPurchaseMetRealtor'];
	$recordClientZip = $_POST['recordClientZip'];
	$recordClientPhone = $_POST['recordClientPhone'];
	$recordClientEmail = $_POST['recordClientEmail'];

	$adresdo = "[email protected]";
	$temat = "formularz"
	$zawartosc = "Imię: ".$ecordClientNameFirst."\n"
		."Nazwisko: ".$recordClientNameLast."\n"
		."Adres1: ".$recordClientAddress1."\n"
		."Adres2: ".$recordClientAddress2."\n"
		."Miasto: ".$recordClientCity."\n"
		."Płeć: ".$recordPurchaseMetRealtor."\n"
		."Kod pocztowy: ".$recordClientZip."\n"
		."Telefon: ".$recordClientPhone."\n"
		."Adres email: ".$recordClientEmail."\n";

	$adresod = "www.beyo.pl";

	mail($adresdo, $temat, $zawartosc, $adresod);
?>
<html>
<head>
<title>komentarz przyjęty</title>
</head>
<body>
<h1>Komentarz przyjęty</h1>
</body>
</html>

Kod formularza:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<a class="linkification-ext" href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" title="Linkification: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>
<html xmlns="<a class="linkification-ext" href="http://www.w3.org/1999/xhtml" title="Linkification: http://www.w3.org/1999/xhtml">
<http://www.w3.org/1999/xhtml</a><xml:lang="pl" lang="pl">
<head>
 
<title>jQuery accordion form with validation</title>
 
<link rel="stylesheet" href="../assets/demo_blue.css" type="text/css" />
 
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.validate.js"></script>
<script type="text/javascript" src="jquery.maskedinput-1.0.js"></script>
<script type="text/javascript" src="ui.core.js"></script>
<script type="text/javascript" src="ui.accordion.js"></script>
 
<script type="text/javascript">
$(document).ready(function(){
 
    $("#recordClientPhone").mask("999-999-999");
    $("#recordClientPhoneAlt").mask("999-999-999");
    $("#recordClientZip").mask("99-999");
    $("#recordPropertyZip").mask("99-999");
    $("#recordPurchaseZip").mask("99-999");
 
    // add * to required field labels
    $('label.required').append('&nbsp;<strong>*</strong>&nbsp;');
 
    // accordion functions
    var accordion = $("#stepForm").accordion();
    var current = 0;
     
    $.validator.addMethod("pageRequired", function(value, element) {
        var $element = $(element)
        function match(index) {
            return current == index && $(element).parents("#sf" + (index + 1)).length;
        }
        if (match(0) || match(1)) {
            return !this.optional(element);
        }
        return "dependency-mismatch";
    }, $.validator.messages.required)
     
    var v = $("#cmaForm").validate({
        errorClass: "warning",
        onkeyup: false,
        onblur: false,
        submitHandler: function() {
            alert("Wiadomość wysłana, dziękuje!");
            }
                });
     
    // back buttons do not need to run validation
    $("#sf2 .prevbutton").click(function(){
        accordion.accordion("activate", 0);
        current = 0;
    });
    $(".open1").click(function() {
      if (v.form()) {
        accordion.accordion("activate", 1);
        current = 1;
      }
    });
    $(".open0").click(function() {
      if (v.form()) {
        accordion.accordion("activate", 0);
        current = 0;
      }
    });
  
});
</script>
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
</head>
  
 
<body>
 
<div id="wrap">
<div id="main">
 
<form name="cmaForm" id="cmaForm" method="post" action="check.php">
<input type="hidden" name="recordRequestPrimaryServiceID" id="recordRequestPrimaryServiceID" value="100" />
<input type="hidden" name="recordClientServices" id="recordClientServices" value="1,2" />
<ul id="stepForm" class="ui-accordion-container">
    <li id="sf1"><a href='#' class="ui-accordion-link"> </a>
    <div>
    <fieldset><legend> Część 1 z 2 </legend>
    <div class="requiredNotice">*Pola obowiązkowe</div>
    <h3 class="stepHeader">Pytnia na temat 1</h3>
    <label for="recordClientNameFirst" class="input required">Imię</label>
    <input name="recordClientNameFirst" id="recordClientNameFirst" class="inputclass pageRequired" title="Proszę o wpisanie swojego imienia " maxlength="254" size="20" /> <br />
    <label for="recordClientNameLast" class="input required">Nazwisko</label> <input name="recordClientNameLast" id="recordClientNameLast" class="inputclass pageRequired" maxlength="254" title="Proszę o wpisanie swojego nazwiska" /> <br />
    <label for="recordClientAddress1" class="input required">Adres</label> <input name="recordClientAddress1" id="recordClientAddress1" class="inputclass pageRequired" maxlength="254" title="Proszę o wpisanie swojego adresu" /> <br />
    <label for="recordClientAddress2" class="input"></label> <input name="recordClientAddress2" id="recordClientAddress2" class="inputclass" maxlength="254" /> <br />
    <label for="recordClientCity" class="input required">Miasto</label> <input name="recordClientCity" id="recordClientCity" class="inputclass pageRequired" maxlength="254" title="Proszę o wpisanie miasta" /> <br />
    <div class="formspacer"></div>
    <div class="buttonWrapper"><input name="formNext1" type="button" class="open1 nextbutton" value="Next" alt="Next" title="Następny" /></div>
    </fieldset>
    </div>
    </li>
    <li id="sf2">
    <a href='#' class="ui-accordion-link">
    </a>
    <div>
    <fieldset><legend> Część 2 of 2 </legend>
    <div class="requiredNotice">*Pola obowiązkowe</div>
    <h3 class="stepHeader">Pytania na temat 2</h3>
    <label for="recordPurchaseMetRealtor" class="input required">Płeć</label>&nbsp;&nbsp;&nbsp;&nbsp; Mężczyzna:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="recordPurchaseMetRealtor" type="radio" checked="checked" class="inputclass" value="0" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kobieta: <input name="recordPurchaseMetRealtor" type="radio" class="inputclass pageRequired" value="1" title="Proszę wybrać jedną z opcji" /><br>
    <label for="recordClientZip" class="input required">Kod pocztowy:</label> <input name="recordClientZip" id="recordClientZip" class="inputclass pageRequired" maxlength="12" title="Proszę wpisać kod pocztowy" /> <br />
    <label for="recordClientPhone" class="input required">Numer telefonu</label> <input name="recordClientPhone" id="recordClientPhone" class="inputclass pageRequired" maxlength="254" title="Proszę o wpisanie numeru telefonu" /> <br />
    <label for="recordClientEmail" class="input required">Adres e-mail</label> <input name="recordClientEmail" id="recordClientEmail" class="inputclass pageRequired email" maxlength="254" title="Proszę o wpisanie adresu e-mail" /> <br />
    <div class="buttonWrapper"><input name="formBack1" type="button" class="open1 prevbutton" value="Back" alt="Back" title="Powrót" />
    <input name="submit" type="submit" id="submit" value="Submit" class="submitbutton" alt="submit" title="Wyślji"></div>    </fieldset>
    </div>
    </li>
    </ul>
</form>
 
</div>
</div>
 
</body>
</html>
0

komunikat o przyjeciu komentarza z check.php zawsze sie pojawia, a tak byc nie powinno, poniewaz mail() nie zawsze zgadza sie na tę operację.
http://php.net/manual/en/function.mail.php

mail() napisał(a)

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.

a poza tym to proponuję zrobić takie proste zweryfikowanie tego, czy rzeczywiście check.php jest wywoływane,

<?php
        $recordClientNameFirst = $_POST['recordClientNameFirst'];
        $recordClientNameLast = $_POST['recordClientNameLast'];
        $recordClientAddress1 = $_POST['recordClientAddress1'];
        $recordClientAddress2 = $_POST['recordClientAddress2'];
        $recordClientCity = $_POST['recordClientCity'];
        $recordPurchaseMetRealtor = $_POST['recordPurchaseMetRealtor'];
        $recordClientZip = $_POST['recordClientZip'];
        $recordClientPhone = $_POST['recordClientPhone'];
        $recordClientEmail = $_POST['recordClientEmail'];

        $adresdo = "[email protected]";
        $temat = "formularz"
        $zawartosc = "Imię: ".$ecordClientNameFirst."\n"
                ."Nazwisko: ".$recordClientNameLast."\n"
                ."Adres1: ".$recordClientAddress1."\n"
                ."Adres2: ".$recordClientAddress2."\n"
                ."Miasto: ".$recordClientCity."\n"
                ."Płeć: ".$recordPurchaseMetRealtor."\n"
                ."Kod pocztowy: ".$recordClientZip."\n"
                ."Telefon: ".$recordClientPhone."\n"
                ."Adres email: ".$recordClientEmail."\n";

        $adresod = "www.beyo.pl";

$mes=        mail($adresdo, $temat, $zawartosc, $adresod)?'przyjęty':'odrzucony';
ob_start();
print_r($_REQUEST);
file_put_contents(".requests.txt",date('c')."\n".ob_get_clean()."\n000\n");
?>
<html>
<head>
<title>informacja</title>
</head>
<body>
<h1>Komentarz <?php echo $mes; ?></h1>
</body>
</html>
0

A więc już wiem że check.php nie jest wywoływane, a czy ktoś może pomóc i powiedzieć co jest tego przyczyną?

0

moj plik check.php

<?php
ob_start();
print_r($_REQUEST);
file_put_contents(".requests.txt",ob_get_clean()."\r\n\r\n",FILE_APPEND);
?>

plik input.htm
wystarczy dodać

    var v = $("#cmaForm").validate({
        errorClass: "warning",
        onkeyup: false,
        onblur: false,
        submitHandler: function() {
			jQuery.ajax({
			  type: "post",
			  data: $("#cmaForm").serialize(), // assuming this == the form
			  url: $("#cmaForm").attr('action')
			});
            alert("Wiadomość wysłana, dziękuje!" + "\n"+$("#cmaForm").serialize());
            }
                });

całość:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<a class="linkification-ext" href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" title="Linkification: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>
<html xmlns="<a class="linkification-ext" href="http://www.w3.org/1999/xhtml" title="Linkification: http://www.w3.org/1999/xhtml">
<http://www.w3.org/1999/xhtml</a><xml:lang="pl" lang="pl">
<head>
 
<title>jQuery accordion form with validation</title>
 
<link rel="stylesheet" href="../assets/demo_blue.css" type="text/css" />
 
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<script type="text/javascript" src="http://plugins.jquery.com/files/jquery.maskedinput-1.2.2.js.txt"></script>
<script type="text/javascript" src="http://scripts.mindtouch.com/res/jqueryui/ui.core.js.txt"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"><!-- ui.accordion.js --></script>
 
<script type="text/javascript">
$(document).ready(function(){
 
    $("#recordClientPhone").mask("999-999-999");
    $("#recordClientPhoneAlt").mask("999-999-999");
    $("#recordClientZip").mask("99-999");
    $("#recordPropertyZip").mask("99-999");
    $("#recordPurchaseZip").mask("99-999");
 
    // add * to required field labels
    $('label.required').append('&nbsp;<strong>*</strong>&nbsp;');
 
    // accordion functions
    var accordion = $("#stepForm").accordion();
    var current = 0;
     
    $.validator.addMethod("pageRequired", function(value, element) {
        var $element = $(element)
        function match(index) {
            return current == index && $(element).parents("#sf" + (index + 1)).length;
        }
        if (match(0) || match(1)) {
            return !this.optional(element);
        }
        return "dependency-mismatch";
    }, $.validator.messages.required)
     
    var v = $("#cmaForm").validate({
        errorClass: "warning",
        onkeyup: false,
        onblur: false,
        submitHandler: function() {
			jQuery.ajax({
			  type: "post",
			  data: $("#cmaForm").serialize(), // assuming this == the form
			  url: $("#cmaForm").attr('action')
			});
            alert("Wiadomość wysłana, dziękuje!" + "\n"+$("#cmaForm").serialize());
            }
                });
     
    // back buttons do not need to run validation
    $("#sf2 .prevbutton").click(function(){
        accordion.accordion("activate", 0);
        current = 0;
    });
    $(".open1").click(function() {
      if (v.form()) {
        accordion.accordion("activate", 1);
        current = 1;
      }
    });
    $(".open0").click(function() {
      if (v.form()) {
        accordion.accordion("activate", 0);
        current = 0;
      }
    });
 
});
</script>
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
</head>
 
 
<body>
 
<div id="wrap">
<div id="main">
 
<form name="cmaForm" id="cmaForm" method="post" action="check.php">
<input type="hidden" name="recordRequestPrimaryServiceID" id="recordRequestPrimaryServiceID" value="100" />
<input type="hidden" name="recordClientServices" id="recordClientServices" value="1,2" />
<ul id="stepForm" class="ui-accordion-container">
    <li id="sf1"><a href='#' class="ui-accordion-link"> </a>
    <div>
    <fieldset><legend> Część 1 z 2 </legend>
    <div class="requiredNotice">*Pola obowiązkowe</div>
    <h3 class="stepHeader">Pytnia na temat 1</h3>
    <label for="recordClientNameFirst" class="input required">Imię</label>
    <input name="recordClientNameFirst" id="recordClientNameFirst" class="inputclass pageRequired" title="Proszę o wpisanie swojego imienia " maxlength="254" size="20"/> <br />
    <label for="recordClientNameLast" class="input required">Nazwisko</label> <input name="recordClientNameLast" id="recordClientNameLast" class="inputclass pageRequired" maxlength="254" title="Proszę o wpisanie swojego nazwiska"/> <br />
    <label for="recordClientAddress1" class="input required">Adres</label> <input name="recordClientAddress1" id="recordClientAddress1" class="inputclass pageRequired" maxlength="254" title="Proszę o wpisanie swojego adresu" /> <br />
    <label for="recordClientAddress2" class="input"></label> <input name="recordClientAddress2" id="recordClientAddress2" class="inputclass" maxlength="254" /> <br />
    <label for="recordClientCity" class="input required">Miasto</label> <input name="recordClientCity" id="recordClientCity" class="inputclass pageRequired" maxlength="254" title="Proszę o wpisanie miasta" /> <br />
    <div class="formspacer"></div>
    <div class="buttonWrapper"><input name="formNext1" type="button" class="open1 nextbutton" value="Next" alt="Next" title="Następny" /></div>
    </fieldset>
    </div>
    </li>
    <li id="sf2">
    <a href='#' class="ui-accordion-link">
    </a>
    <div>
    <fieldset><legend> Część 2 of 2 </legend>
    <div class="requiredNotice">*Pola obowiązkowe</div>
    <h3 class="stepHeader">Pytania na temat 2</h3>
    <label for="recordPurchaseMetRealtor" class="input required">Płeć</label>&nbsp;&nbsp;&nbsp;&nbsp; Mężczyzna:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="recordPurchaseMetRealtor" type="radio" checked="checked" class="inputclass" value="0" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kobieta: <input name="recordPurchaseMetRealtor" type="radio" class="inputclass pageRequired" value="1" title="Proszę wybrać jedną z opcji" /><br>
    <label for="recordClientZip" class="input required">Kod pocztowy:</label> <input name="recordClientZip" id="recordClientZip" class="inputclass pageRequired" maxlength="12" title="Proszę wpisać kod pocztowy" /> <br />
    <label for="recordClientPhone" class="input required">Numer telefonu</label> <input name="recordClientPhone" id="recordClientPhone" class="inputclass pageRequired" maxlength="254" title="Proszę o wpisanie numeru telefonu" /> <br />
    <label for="recordClientEmail" class="input required">Adres e-mail</label> <input name="recordClientEmail" id="recordClientEmail" class="inputclass pageRequired email" maxlength="254" title="Proszę o wpisanie adresu e-mail" /> <br />
    <div class="buttonWrapper"><input name="formBack1" type="button" class="open1 prevbutton" value="Back" alt="Back" title="Powrót" />
    <input name="submit" type="submit" id="submit" value="Submit" class="submitbutton" alt="submit" title="Wyślji"></div>    </fieldset>
    </div>
    </li>
    </ul>
</form>
 
</div>
</div>
 
</body>
</html>

nie dodałeś w ogóle przesyłania formularza, tutaj jakiś tam pierwszy temat z tym, co potrzebowałeś:

1 użytkowników online, w tym zalogowanych: 0, gości: 1