title: phone number validation in check_phone function
body: <p>I have a signup.php file with a script that does validation for username and email. I have added a phone number field in the php file and added it in the database too as varchar(15). Everything is working fine but it accepts any crap entered in the field. What syntax should I add in the below script to validate phone number?</p>
  
  <p>Required validation
  *The textbox should allow 11 digit number as input. 
  *If user enters a 10 digit number, in the database it should update the database table field as +91 followred by the 10 digit number
  *If user enters a 11 digit number starting with 0, it should remove the zero and update the database table field as +91 followred by the 10 digit number (removing the 0)
  *alphabets and special character not allowed</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function check_username(){
      var b=$('#username').val();
      if(b.length&lt;3){
          $('#username').css('border','2px solid #a50000')
      }else{
          $.get("system/ajax.php?a=checkUser",{data:b},function(a){
              if(a==1){
                  $('#username').css('border','2px solid #00a500')
              }else{
                  $('#username').css('border','2px solid #a50000')
              }
          })
      }
  }
  function check_email(){
      var b=$('#email').val();
      if(b.length&lt;3){
          $('#email').css('border','2px solid #a50000')
      }else{
          $.get("system/ajax.php?a=checkEmail",{data:b},function(a){
              if(a==1){$('#email').css('border','2px solid #00a500')
              }else{
                  $('#email').css('border','2px solid #a50000')
              }
          })
      }
  }
  function check_email2(){
      var a=new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);
      var b=$('#email').val();
      var c=$('#email2').val();
      if(!a.test(c)){
          $('#email2').css('border','2px solid #a50000')
      }else if(b==c){
          $('#email2').css('border','2px solid #00a500')
      }else{
          $('#email2').css('border','2px solid #a50000')
      }
  } 
  &lt;/script&gt;
  </code></pre>
  
  <p>Thank you</p>