Oracle, php - add action in form
<p>I'm trying to make this button checking if Employee ID passing via textbox exsits in Oracle Database and depend on result - show YES or NO after ':'.</p>

<p><a href="https://i.stack.imgur.com/YdiiW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YdiiW.png" alt="enter image description here"></a></p>

<p>But i have absolutely no idea how. I tried to make a form in a form:</p>

<pre><code>&lt;form action="addemp.php" method="POST"&gt;
    &lt;table&gt;
    &lt;tr&gt;
    &lt;td&gt;Employee ID: &lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="empid" size=1/&gt; 
    &lt;form action="check.php" method="POST"&gt;
    &lt;input type="submit" name="check" value="Check?"&gt; :
    &lt;/form&gt;
</code></pre>

<p>But no success since It can not be done. 
Any suggestions?
EDIT:</p>

<p>check.php</p>

<pre><code>&lt;?php

     $conn = oci_connect('hr', 'hr', 'hr');
      $stid = oci_parse($conn, "select count(*) from employees where employee_id=TO_NUMBER(".$_GET['idprac'].")");
     oci_execute($stid);
    $result = oci_num_rows($stid);
    // Use this $empId and check in query.

    if($result==1){
      echo "free";
    } else 
    {
      echo "owned";
    }

    ?&gt;
</code></pre>

<p>code in index.html</p>

<pre><code>    &lt;td&gt;&lt;input type="text" name="idprac" size=1/&gt; 
    &lt;input type="button" name="check" class='checkEmp' value="Check?"&gt; : &lt;span class='showResult'&gt;&lt;/span&gt;


    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
  $('.checkEmp').click(function(){
    var empId= $('#idprac').val();
    $.ajax({url:"check.php?idprac="+empId,cache:false,success:function(result){
      $('.showResult').html(result);
    }});
  });
&lt;/script&gt;
</code></pre>

<p>But ajax does not want to pass parameter to check.php (undefined error) and if i set <code>var empID = whatever number</code> gives me always 'owned'.</p>