title: Extract a table row data in html
body: <p>Please see the below while loop which displays the data from a table on loading of the page.</p>
  
  <pre><code>&lt;?php 
  $idcount;
  $jobcount;
  $flagcount;
  while ( $row = sqlsrv_fetch_array ( $stmt, SQLSRV_FETCH_ASSOC ) ) 
      {
          if ($row ['Active'] == '1') {
              $flag = 'checked = "checked"';
          } else {
              $flag = '';
          }
          echo ("&lt;tr&gt;
              &lt;td id = jid$idcount&gt;".$row['JobTypeID']."&lt;/td&gt;
              &lt;td id = jtype$jobcount&gt;".$row['Jobtype']."&lt;/td&gt;
              &lt;td align='center'&gt;&lt;input id=active$flagcount type='checkbox' name='activecheck' $flag disabled &gt;&lt;/td&gt;
              &lt;td align='center'&gt;&lt;a class = 'toedit' href=# onclick = 'edit($idcount)'&gt;Edit&lt;/a&gt; | &lt;a href=# onclick = 'dele($idcount)'&gt;Delete&lt;/a&gt;&lt;/td&gt;
              &lt;/tr&gt;");
          $flag = '';
          $idcount += 1;
          $jobcount += 1;
          $flagcount += 1;
      }
      ?&gt;
  </code></pre>
  
  <p>My aim is that, when I click on the <code>Edit</code> link, I need to fill a form with the corresponding row data.</p>
  
  <p>I am intending to use javascript to carry out the processing after the data from the row has been copied, but I am not clear about how to extract the corresponding row data for every Edit link.</p>
  
  <p>I am very new to PHP, so please guide me.</p>
  
  <p>EDIT: Below is the code of the form that I am using</p>
  
  <pre><code>&lt;form name="job" id="ForNew" method="post"  action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;"&gt;
  
          &lt;input type="hidden" id="JID" value=""&gt;
  
          Job Type &lt;input type="text" id="JType"name="jobtype" value="&lt;?php echo htmlspecialchars($JobTypeValue);?&gt;"&gt;
          &lt;span class="error"&gt;&lt;?php echo $JobTypeErr;?&gt;&lt;/span&gt;&lt;br&gt; 
  
          Active? Yes &lt;input type="radio" id = "JRadio"name="radio"&lt;?php if (isset($ActiveValue) &amp;&amp; $ActiveValue == "yes") echo "checked"; ?&gt;value="yes"&gt; 
          No &lt;input type="radio" id ="JRadio" name="radio"&lt;?php if (isset($ActiveValue) &amp;&amp; $ActiveValue == "no") echo "checked"; ?&gt;value="no"&gt; 
          &lt;span class="error"&gt;&lt;?php echo $ActiveErr;?&gt;&lt;/span&gt;&lt;br&gt;
  
          &lt;input type="submit" name="sub" value="Submit!"&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>EDIT 2:
  I have written the function <code>edit()</code> as follows, but the value that gets returned is in the form of <code>Object object</code>. But the value that I need is id name of each specific <code>&lt;td&gt;</code>, so that I can copy its value into the form textbox.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function edit(Data)
  {
      //Get data with reference to ID
      var Num = String(Data);
      alert("Entered Function! " + Num);
      alert("JID n Data"+$('jid'+Num));
      alert("JID value " + Num);
      alert(console.log(Num));
      $('#JID').val($('jid'+Data).html());
      $('#JType').val($('jtype'+Data).html());
      $('#JRadio').val($('active'+Data).html());
  }
  </code></pre>
  
  <p>Even if I do not convert <code>var Num = String(Data);</code> to String, I am getting the same result of <code>Object object</code>.</p>