<?php

  include_once('dbconnection.php');

?>
<html>
<head>
     <title> Display Client Details</title>
     <link rel="stylesheet" type="text/css" href="style.css">
   </head>

  <body>
    <!-- Display Details records from database -->
<div>

  <p><a href = "displayClient.php"> Display</a>
|  <a href = "formClient.html"> Insert New Record</a> </p>

<table id="tblClient" name="tbl" width="600" border="1" cellpadding="1" cellspacing="2"action="editClient.php" method="GET" >
<tr>
  <h3> View Client Details</h3>
    <td><strong>First Name</td>
    <td><strong>Last Name</td>
    <td><strong>ID Number</td>
    <td><strong>Account Type</td>
    <td><strong>Date Of Birth</td>
    <td><strong>Gender</td>
    <td><strong>Account Status Active?</td>
    <td><strong>Date Created</td>
    <td><strong>Edit user</td>
  </tr>

<?php
$sql = "SELECT * FROM tbl_client";
$results = mysqli_query($conn, $sql);
       while($client = mysqli_fetch_assoc($results)){
         echo "<tr>".
         "<td >".$client['str_fname']."</td>".
         "<td>".$client['str_lname']."</td>".
         "<td>".$client['str_idNum']."</td>".
         "<td>".$client['str_type']."</td>".
         "<td>".$client['str_dob']."</td>".
         "<td>".$client['str_gender']."</td>".
         "<td>".$client['str_status']."</td>".
         "<td>".$client['tms_dateCreated']."</td>".
         "<td> <a type=\"submit\" href=\"editClient.php\">".$client['int_ID']."</a></td>".
         "</tr>";
      }
      //end whiles
?>
</table>
<script defer>
  var table = document.getElementById('tbl');
  for(var i = 1; i < table.rows.length; i++){
    table.rows[i].onclick = function(){
    //rIndex = this.rowIndex;
    this.cells[0];
    this.cells[1];
    this.cells[2];
    <?php $selectedUser = array(this.cells[0], this.cells[1],  this.cells[2], this.cells[3], this.cells[4], this.cells[5], this.cells[6], this.cells[7],  this.cells[8]); ?>
    break;
    };
  }
</script>

</div>
</body>
</html>
