
Kod formularza:
<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(' <strong>*</strong> '); // accordion functions var accordion = $("#stepForm").accordion(); $.validator.addMethod("pageRequired", function(value, element) { var $element = $(element) function match(index) { } 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); }); $(".open1").click(function() { if (v.form()) { accordion.accordion("activate", 1); } }); $(".open0").click(function() { if (v.form()) { accordion.accordion("activate", 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> Mężczyzna: <input name="recordPurchaseMetRealtor" type="radio" checked="checked" class="inputclass" value="0" /> 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>
Kod 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 = "wojtek@pl"; $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.costam.pl"; ?> <html> <head> <title>komentarz przyjęty</title> </head> <body> <h1>Komentarz przyjęty</h1> </body> </html>