PHP - Get the id of the table row clicked
<p>I'm currently creating the account management system of my website and I decided to add a feature that enables me to declare weather a specific account is active or inactive. The data is retrieved from my mysql table.</p>

<pre><code>$query = mysqli_query($DBConnect,"SELECT * from REG");
echo "&lt;table class = 'table'  style = 'width:90%;text-align:center'&gt;";
        while($getData = mysqli_fetch_assoc($query))
        {
            $username = $getData['uname'];
            $fname = $getData['fname'];
            $mname = $getData['mname'];
            $lname = $getData['lname'];
            $bday = $getData['bday'];
            $email = $getData['email'];
            $contact = $getData['contact'];
            $gender = $getData['gender'];
            if($getData['userlevel'] == 1)
            {
                $userlevel = "user";
            }
            else
            {
                $userlevel = "admin";
            }
            if($getData['status'] == 1)
            {
                $status = "active";
            }
            else
            {
                $status = "disabled";
            }

            echo "&lt;tr&gt;";
            echo "&lt;td&gt;$username&lt;/td&gt;&lt;td&gt;$fname&lt;/td&gt;&lt;td&gt;$mname&lt;/td&gt;&lt;td&gt;$lname&lt;/td&gt;&lt;td&gt;$bday&lt;/td&gt;&lt;td&gt;$email&lt;/td&gt;&lt;td&gt;$contact&lt;/td&gt;&lt;td&gt;$gender&lt;/td&gt;&lt;td&gt;$userlevel&lt;/td&gt;&lt;td&gt;
            &lt;a href ='..\status.php' &gt;$status &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";

        }
        echo "&lt;/table&gt;";
</code></pre>

<p>This is the content of status.php</p>

<pre><code>session_start();
$DBConnect = mysqli_connect("localhost", "root","","kenginakalbo")
or die ("Unable to connect".mysqli_error());


$query = mysqli_query($DBConnect,"SELECT * from REG where id = '$_SESSION[id]'");
        while($getData = mysqli_fetch_assoc($query))
        {
            $status = $getData['status'];
            echo "'$_SESSION[id]'";
        }

if($status == 1)
{
    $query = mysqli_query($DBConnect, "UPDATE REG SET status = 0 where id = '$_SESSION[id]'");
}
else if ($status == 0)
{
    $query = mysqli_query($DBConnect, "UPDATE REG SET status = 1 where id = '$_SESSION[id]'");
}

header("Location: admin/login.php");
</code></pre>

<p>What I need to do is get the ID of the row clicked and declare it in my session so that it can be used in the "status.php" file. But in this code, the last id in the table is the one that is declared into the session because of the loop. How do I get the value of the id of the row that is clicked? (is there sort of like onClick function in php? Thank you.</p>