Q:

hiding table row when checkbox clicked

I have this Table ,and fetching row using this php code ,when i click on  this checkbox one alert message is shown ,if user click on ok button of that alert, than i want to hide that perticular row.  
<table>
    <tr>
        <th style="height: 25px">NAME</th>
        <th style="height: 25px">EMAIL</th>
        <th style="height: 25px">CELL NO</th>
        <th style="height: 25px">CITY</th>                   
        <th>Hide Candidate</th>
    </tr>
</table>

<?php
while($data_set1 = mysql_fetch_array($result))
{
    echo "<tr>";
    echo "<td>{$data_set1['ename']}</td>";
    echo "<td>{$data_set1['eemail']}</td>";
    echo "<td>{$data_set1['ecell']}</td>";
    echo "<td>{$data_set1['ecity']}</td>";

    echo "<td><input type=\"checkbox\" name=\"hide_cand\" id=\"hide_cand\" onclick=\"return confirm('This action can not be recovered, are you sure you want to HIDE this Candidate? ')\"/></td>";
    echo "</tr>";
}
?>

A:

Call a function from the onclick instead, passing in the checkbox element. In the function, you can hide it's parent <tr> (row) element.
echo "<td><input type=\"checkbox\" name=\"hide_cand\" id=\"hide_cand\" onclick=\" return hideRow(this)\"/></td>";

Javascript:
function hideRow(checkbox)
{
    if(confirm('This action can not be recovered, are you sure you want to HIDE this Candidate? '))
    {
        checkbox.parentNode.parentNode.style.display = "none";
        return true;
    }
    return false;
}

