2015-10-06 5 views
0

Форма не отправляет и не отправляет в базу данных с помощью connector.php. Я попытался удалить валидацию безрезультатно. Я не знаю, что не так. Этот вопрос прослушивал меня на день или два. Пожалуйста, помогите людям.Почему моя форма не отправляется или отправляется

`

<title>Sign up</title> 
<link href="css/alldatcookies.css" rel="stylesheet" type="text/css" /> 
</head> 

<body> 
<nav class="nav ssm-nav-visible"> 
     <img src="img/swipe.png" alt="swipe image" width="73" height="85" align="right" /> 
     <p><img src="seventhswellicon10.png" width="178" height="169" align="middle" /></p> 

      <ul> 
<li><a class="" href="">Home</a></li> 
<li><a href="">Login</a></li> 
<li><a href="SignUp.html">Sign Up</a></li> 
<li><span style="color: #FFFFFF"></span><a href="">Contact</a></li> 
</ul> 
</nav> 

<form id="msform" name="msform" onSubmit="return checkForm(this)"   action="connector.php" method="POST" > 
<a href="#" style="color:#FFFFFF" class="ssm-open-nav" title="open nav">Menu</a> 
<ul id="progressbar"> 
    <li class="active">Account Setup</li> 
    <li> Profile</li> 
    <li>Personal Details</li> 
    </ul> 
    <fieldset> 
    <h2 class="fs-title">Create your account</h2> 
    <h3 class="fs-subtitle">Step 1</h3> 
     <input id="username" name="username" placeholder="In Game Username"/> 
    <input id="email" name="email" placeholder="email"/> 
    <br /> 
    <input type="password" id="pass" name="pass" placeholder="Password" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}"onchange="form.cpass.pattern = this.value;"> 
    <br /> 
    <input type="password" id="cpass" name="cpass" placeholder="Confirm Password" onKeyUp="checkPass(); return false;" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}"/> <br /> 
    <input type="button" name="next" class="next action-button" value="Next" /> 
    </fieldset> <fieldset><h2 class="fs-title">Social Profiles</h2> 
    <h3 class="fs-subtitle">Your presence on the social network</h3> 
    <input type="text" name="twitter" placeholder="Twitter" /> 
    <input type="text" name="facebook" placeholder="Facebook" /> 
    <input type="text" name="gplus" placeholder="Google Plus" /> 
    <input type="button" name="previous" class="previous action-button" value="Previous" /> <input type="button" name="next" class="next action-button" value="Next" /> </fieldset> 
    <fieldset> 
    <h2 class="fs-title">Personal Details </h2> 
    <input type="text" id="firstname" name="firstname" placeholder="First Name" value="" /><br /> 
     <br /> 
    <input type="text" id="lastname" name="lastname" placeholder="Last Name" /> 
    <br /> 
    <input type="tel" id="phone" name="phone" placeholder="Phone" /> 
    <br /> 
    </textarea> 
     <input type="button" name="previous" class="previous action-button" value="Previous" /> 
     <input type="submit" name="submit" id="msform"class="submit action-button" value="Submit"/> 
     </fieldset> 
     </form> 
     <script language="javascript">function validateForm() 
     { 
     var x=document.forms["msform"]["firstname"].value; 
     if (x==null || x=="") 
     { 
     writeError("First name must be filled out"); 
     return false; } 
     return true 
     } 
     function validateForm() 
     { 
     var x=document.forms["msform"]["lastname"].value; 
     if (x==null || x=="") 
     { 
     writeError("Last name must be filled out"); 
     return false; 
     } 
     return true 
     } 
     function validateForm() 
     {re = /[1-10]/; 
     var x=document.forms["msform"]["phone"].value; 
     if (x==null || x=="") 
     { 
     writeError("Phone number must be filled out"); 
     return false; 
     } 
     else 
     { 
     if(!re.test(document.forms["msform"]["phone"].value)) { 
     writeError("Phone must at least contain 10 numbers ex. 1234567890!"); 
     document.forms["msform"]["phone"].focus(); 
     return false; 
     } 
     return true 
     } 
     } 
     function validateForm() 
     { 
     var x=document.forms["msform"]["username"].value; 
     if (x==null || x=="") 
     { 
     writeError("Username must be filled out"); 
     return false; 
     } 
     re = /^\w+$/; 
     if(!re.test(document.forms["msform"]["username"].value)) { 
     $(this).w2tag.alert("Username must contain only letters, numbers and  underscores!"); 
     document.forms["msform"]["username"].focus(); 
     return false; 
     } 
     return true 
     } 
     function validateForm() 
     { 
     var x=document.forms["msform"]["email"].value; 
     var atpos=x.indexOf("@"); 
     var dotpos=x.lastIndexOf("."); 
     if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) 
     { 
     writeError("Not a valid e-mail address"); 

      return false; 
     } 
     return true 

     } 

     function checkPass() 

     { 

     //Store the password field objects into variables ... 

     var pass1 = document.getElementById('pass'); 

     var pass2 = document.getElementById('cpass'); 

     //Store the Confimation Message Object ... 

     var message = document.getElementById('confirmMessage'); 

     //Set the colors we will be using ... 

     var goodColor = "#66cc66"; 

     var badColor = "#ff6666"; 

     //Compare the values in the password field 

     //and the confirmation field 

     if(pass1.value == pass2.value){ 

     //The passwords match. 

     //Set the color to the good color and inform 

     //the user that they have entered the correct password 

     pass2.style.backgroundColor = goodColor; 

     message.style.color = goodColor; 

     message.w2tag = "Passwords Match!"; 

     }else{ 

     return false 

     { 

     //The passwords do not match. 

     //Set the color to the bad color and 

//notify the user. 

     pass2.style.backgroundColor = badColor; 

     message.style.color = badColor; 

     message.w2tag = "Passwords Do Not Match!"; 

     } 

     return true 

     } 

     } 

     </script> 

     <style type="text/css"> 

     {}options: { 

     css : {, ;// css rules for input 

     class : '', ;// class name for input 

     onShow : null, ;// function to execute when overlay is shown 

     onHide : null ;// function to execute when overlay is hidden 

     } 

     </style> 

     <!-- jQuery --> 


    <script src="Javascript/jquery-2.1.0.min.js" type="text/javascript">      </script> 


     <!-- jQuery easing plugin --> 
     <script src="Javascript/jquery.easing.min.js" type="text/javascript"></script> 

     <script src="css/cookiemonster.js" type="text/javascript"></script>     

    <script 

      src="http://labs.rampinteractive.co.uk/touchSwipe/jquery.touchSwipe.min.js"> 

    </script> 

    <script src="jquery.slideandswipe.min.js"></script> 

    <div class="ssm-overlay"></div> 


    <script> 

     $(document).ready(function() { 

      $('.nav').slideAndSwipe(); 

    }); 

     </script> 



     </body> 

     </html>` 
+0

Вы переопределяете функцию 'validateForm' несколько раз – Lucius

+0

oh noes thanks. – Orenrocco

+0

Я избавился от функций переопределения, однако он все еще не отправляет – Orenrocco

ответ

0

Это не кажется, что у вас есть что-нибудь в вашем скрипте, который активирует его. Обычно вы хотите, чтобы скрипт начинался с щелчка или что-то в этом роде ... у вашего кода не было никаких событий для запуска функций.

Посмотрите на этот site, который демонстрирует включение кнопки отправки с .addEvent.

+0

спасибо вам большое – Orenrocco

Смежные вопросы