title: Call to a member function saveSibling() on a non-object?
body: <p>i added the code to add the row dynamically to the form and when user submit the form it will call the function(saveSibling) of the application object that will save the data into the database(Sibling table)but it doesnt work. when all data has been submitted user will be redirected to updateAppplication.php</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$userID = $_SESSION['username'];
   $a = new application();
   $nameSib = $jobSib = $relationshipSib  = $jabatan = $age = $statusSib = "";
   
   $check = true;
   
   if ($_SERVER["REQUEST_METHOD"] == "POST")
   { 
    //save n cont to next form
      if(isset($_POST['saveContinue']))
      {
     $nameSib = $_POST['nameSib'];
     $jobSib = $_POST['jobSib'];
     $relationshipSib = $_POST['relationshipSib'];
     $jabatan = $_POST['jabatan'];
     $age = $_POST['age'];
     $statusSib = $_POST['statusSib'];
      
     foreach($nameSib as $a =&gt; $b)
     {
      if(isset($_POST['nameSib']) &amp;&amp; isset($_POST['relationshipSib']) &amp;&amp; isset($_POST['age']) &amp;&amp; isset($_POST['statusSib']) || isset($_POST['jobSib']) || isset($_POST['jabatan']))
       $a -&gt; saveSibling($userID, $nameSib[$a], $relationshipSib[$a], $age[$a], $statusSib[$a], $jobSib[$a], $jabatan[$a]);
     }
     header('Location: displayApplication.php');
     
    }
    
   }</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public function saveSibling($studID, $nameSib,  $relationshipSib, $age, $statusSib, $jobSib, $jabatan)
   {
    $this -&gt; studID = $studID;
    $this -&gt; nameSib = $nameSib;
    $this -&gt; jobSib = $jobSib;
    $this -&gt; relationshipSib = $relationshipSib;
    $this -&gt; age = $age;
    $this -&gt; statusSib = $statusSib; 
    $this -&gt; jabatan = $jabatan;
    
    $query = mysql_query("SELECT appID FROM application WHERE (studID = '" . mysql_real_escape_string($studID) . "')");
    while($row = mysql_fetch_array($query)) 
    {
     $appID = $row['appID'];
     $sql = "INSERT INTO `sibling`(`nameSib`, `jobSib`, `relationshipSib`, `age`, `statusSib`, `jabatan`, `appID`) 
       VALUES ('$nameSib', '$jobSib', '$relationshipSib', '$age', '$statusSib', '$jabatan', '$appID')";
     $query2 = mysql_query($sql);
     if(!$query2)
      echo mysql_error();
    }
    
    
   }</code></pre>
  </div>
  </div>
  </p>