title: Insert data to MySql with 2 input value
body: <p>I have 1 table and I want to insert 2 values into MySql. However, there is only one value goes into my database and the other remains empty.</p>
  
  <p>The design of my mySql table:
  <a href="https://i.stack.imgur.com/yWLbO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yWLbO.png" alt="enter image description here"></a></p>
  
  <p>My Html table code is below:</p>
  
  <pre><code>&lt;table&gt;
  
     &lt;tr&gt;
         &lt;th&gt;&lt;/th&gt;
         &lt;th&gt;Main Applicant&lt;/th&gt;
         &lt;th&gt;Joint Applicant1&lt;/th&gt;
  
    &lt;/tr&gt;
    &lt;tr&gt;
         &lt;td&gt;Name&lt;/td&gt;
         &lt;td&gt;&lt;input type="text"   id="nameMain" name="nameMain" class="form-control" autocomplete="off" required&gt;&lt;/td&gt;
        &lt;td&gt;&lt;input type="text"   id="nameJoint1" name="nameJoint1" class="form-control" autocomplete="off" required&gt;&lt;/td&gt;
  
  
    &lt;/tr&gt;
  
    &lt;tr&gt;
        &lt;td&gt;Nationality(Country)&lt;/td&gt;
        &lt;td&gt;&lt;input type="text"  id="nationMain" name="nationMain" class="form-control" autocomplete="off" required&gt;&lt;/td&gt;
        &lt;td&gt;&lt;input type="text"  id="nationJoint1" name="nationJoint1" class="form-control" autocomplete="off" required&gt;&lt;/td&gt;
  
   &lt;/tr&gt;
   &lt;tr&gt;
      &lt;td&gt;Age&lt;/td&gt;
      &lt;td&gt;&lt;input type="number"  id="ageMain" name="ageMain" class="form-control" autocomplete="off" required&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="number"  id="ageJoint1" name="ageJoint1" class="form-control" autocomplete="off" required&gt;&lt;/td&gt;
  
  
  &lt;/tr&gt;
  </code></pre>
  
  <p></p>
  
  <p>My post.php code is below:</p>
  
  <pre><code>       &lt;?php 
  
  
      require_once 'db/dbfunction.php';
      require_once 'db/dbCreditAssessment.php';
  
      session_start();
      $con = open_connection();
  
  
  
      $name = $_POST['nameMain'];
      $nationality = $_POST['nationMain'];
      $age = $_POST['ageMain'];
  
  
      $nameJoint1 = $_POST['nameJoint1'];
      $nationJoint1 = $_POST['nationJoint1'];
      $ageJoint1 = $_POST['ageJoint1'];
  
      addApplicantPersonalDetails($con,$name,$nationality,$age);
  
      addApplicantPersonalDetails2($con,$name,$nationality,$age);
  
      close_connection($con);
  
  
      ?&gt;
  </code></pre>
  
  <p>My addCreditAssessment.php code is below:</p>
  
  <pre><code>    &lt;?php
  
  function addApplicantPersonalDetails($con,$name,$nationality,$age){
  
      $query = "insert into zzz(name,nationality,age) 
              values('$name','$nationality','$age')";            
                   //echo "{$sqlString}";
  
  
  
                   $insertResult = mysqli_query($con, $query);
  
  
                   if($insertResult){
                       echo " Applicant Detail Added !&lt;br /&gt;";
                       echo "&lt;a href='index.php'&gt;Back to Home&lt;/a&gt;";
                   }
                   else {
                       echo " Error !";
                       echo "{$query}";
                       //header('Location: post.php');
                   }
  
  
  }
  
  function addApplicantPersonalDetails2($con,$name,$nationality,$age){
  
  
  
      $query2 = "insert into zzz(name,nationality,age) 
              values('$nameJoint1','$nationJoint1','$ageJoint1')"; 
  
  
                   $insertResult2 = mysqli_query($con, $query2);
  
  
  
                   if($insertResult2){
                       echo " Applicant Detail Added !&lt;br /&gt;";
                       echo "&lt;a href='index.php'&gt;Back to Home&lt;/a&gt;";
                   }
                   else {
                       echo " Error !";
                       echo "{$query2}";
                       //header('Location: post.php');
                   }
  }
  
  
  ?&gt;
  </code></pre>