title: How to insert registration page data into mysql table after verification in php
body: <p>I have make a registration page using php bootsratp. after fillup the registration form if i press the submit button i get msg uploaded successfully...but table is blank...and no validation msg show....if any field is blank
  below is my code</p>
  
  <p><strong>form validation code:</strong></p>
  
  <pre><code>function formValidation()  
  {  
  var uid = document.registration.userid;  
  var passid = document.registration.passid;  
  var uname = document.registration.username;  
  var uadd = document.registration.address;  
  var ucountry = document.registration.country;  
  var uzip = document.registration.zip;  
  var uemail = document.registration.email;  
  var umsex = document.registration.msex;  
  var ufsex = document.registration.fsex; if(userid_validation(uid,5,12))  
  {  
  if(passid_validation(passid,7,12))  
  {  
  if(allLetter(uname))  
  {  
  if(alphanumeric(uadd))  
  {   
  if(countryselect(ucountry))  
  {  
  if(allnumeric(uzip))  
  {  
  if(ValidateEmail(uemail))  
  {  
  if(validsex(umsex,ufsex))  
  {  
  }  
  }   
  }  
  }   
  }  
  }  
  }  
  }  
  return false;  
  
  } function userid_validation(uid,mx,my)  
  {  
  var uid_len = uid.value.length;  
  if (uid_len == 0 || uid_len &gt;= my || uid_len &lt; mx)  
  {  
  alert("User Id should not be empty / length be between "+mx+" to "+my);  
  uid.focus();  
  return false;  
  }  
  return true;  
  }  
  function passid_validation(passid,mx,my)  
  {  
  var passid_len = passid.value.length;  
  if (passid_len == 0 ||passid_len &gt;= my || passid_len &lt; mx)  
  {  
  alert("Password should not be empty / length be between "+mx+" to "+my);  
  passid.focus();  
  return false;  
  }  
  return true;  
  }  
  function allLetter(uname)  
  {   
  var letters = /^[A-Za-z]+$/;  
  if(uname.value.match(letters))  
  {  
  return true;  
  }  
  else  
  {  
  alert('Username must have alphabet characters only');  
  uname.focus();  
  return false;  
  }  
  }  
  function alphanumeric(uadd)  
  {   
  var letters = /^[0-9a-zA-Z]+$/;  
  if(uadd.value.match(letters))  
  {  
  return true;  
  }  
  else  
  {  
  alert('User address must have alphanumeric characters only');  
  uadd.focus();  
  return false;  
  }  
  }  
  function countryselect(ucountry)  
  {  
  if(ucountry.value == "Default")  
  {  
  alert('Select your country from the list');  
  ucountry.focus();  
  return false;  
  }  
  else  
  {  
  return true;  
  }  
  }  
  function allnumeric(uzip)  
  {   
  var numbers = /^[0-9]+$/;  
  if(uzip.value.match(numbers))  
  {  
  return true;  
  }  
  else  
  {  
  alert('ZIP code must have numeric characters only');  
  uzip.focus();  
  return false;  
  }  
  }  
  function ValidateEmail(uemail)  
  {  
  var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;  
  if(uemail.value.match(mailformat))  
  {  
  return true;  
  }  
  else  
  {  
  alert("You have entered an invalid email address!");  
  uemail.focus();  
  return false;  
  }  
  } function validsex(umsex,ufsex)  
  {  
  x=0;  
  
  if(umsex.checked)   
  {  
  x++;  
  } if(ufsex.checked)  
  {  
  x++;   
  }  
  if(x==0)  
  {  
  alert('Select Male/Female');  
  umsex.focus();  
  return false;  
  }  
  else  
  {  
  alert('Form Succesfully Submitted');  
  window.location.reload()  
  return true;  
  }  
  }  
  </code></pre>
  
  <p><strong>This is form design code:</strong></p>
  
  <pre><code>&lt;?PHP
  //require_once("./include/membersite_config.php");
  require_once "formvalidator.php";
  
  //if(isset($_POST['submitted']))
  //{
   //  if($fgmembersite-&gt;RegisterUser())
   //  {
    //      $fgmembersite-&gt;RedirectToURL("thank-you.html");
  //   }
  //}
  
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; 
  &lt;!-- Latest compiled and minified CSS --&gt;
  &lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/style.css"&gt;
  &lt;script src="form-validation.js"&gt;&lt;/script&gt;
  &lt;style&gt;
    body {
      color: #000000;
      font-family:Arial, Geneva, sans-serif, Helvetica, sans-serif;
      line-height: 150%;
      font-size:12px;
      margin:auto;
      background-color:#ffffff;
    }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;title&gt;Registration page&lt;/title&gt;&lt;/head&gt; 
  &lt;body&gt;
      &lt;div class="container"&gt;
       &lt;div&gt;&lt;h2 style="background-color:#00CCCC" align="center" "height:50px"  &gt;Registration page&lt;/h2&gt;&lt;/div&gt;
        &lt;form class="form-horizontal" name='registration' onSubmit="return formValidation()" method="POST" action="insert.php"&gt;
        &lt;fieldset&gt;
        &lt;legend&gt;Registration form&lt;/legend&gt;
         &lt;div class="form-group"&gt;
            &lt;label class="control-label col-xs-4" for="userid"&gt;Fullname:&lt;/label&gt;
               &lt;div class="col-xs-4"&gt;
            &lt;input type="text" class="form-control" id="userid" placeholder="Enter name"&gt;
          &lt;/div&gt;
          &lt;/div&gt;
           &lt;div class="form-group"&gt;
            &lt;label class="control-label col-xs-4" for="uid"&gt;Username:&lt;/label&gt;
               &lt;div class="col-xs-4"&gt;
            &lt;input type="text" class="form-control" id="uid" placeholder="Enter username"&gt;
          &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>This is my insert.php code</p>
  
  <pre><code>&lt;?php
  
  define('DB_HOST', 'localhost');
  define('DB_NAME', 'phonebook');
  define('DB_USER','root');
  define('DB_PASSWORD','');
  
  
  // Connect to server and select database.
  $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
  $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
  
  // Get values from form
  $fullname=$_POST['userid'];
  $username=$_POST['uid'];
  $email=$_POST['uemail'];
  $password=$_POST['passid'];
  $birthdate=$_POST['mytextarea'];
  $country=$_POST['message'];
  
  // Insert data into mysql
  $sql="INSERT INTO tbl_registration(fullname,username,email,password, birthdate,country) VALUES('$fullname', '$username', '$email',  '$password', '$birthdate', '$country')";
  $result=mysql_query($sql);
  </code></pre>
  
  <p>what i will do...</p>