Hi...
Why are you giving two controls the same name..
One is checkbox and other hidden field...
Just put one control...
Use checkbox and give it name as chk[] ... Yes you read right.. Its an array.. Secondly.. give its value as user's id or name (basically the field from which you will search the user in the database..
<?php
mysql_connect("localhost","root","rootwdp");
mysql_select_db("rams");
if($_REQUEST['submit'] == "Activate")
{
$arr=$_REQUEST['chk'];
$empids = implode(",",$arr);
// This will transform your array into a string with empids separated by comma e.g. 1,2,5,7
mysql_query("update ram set status=1 where emp_id in $empids");
//this will set all employee ids in one go..
}
if($_REQUEST['submit'] == "Deactivate")
{
$arr=$_REQUEST['chk'];
$empids = implode(",",$arr);
// This will transform your array into a string with empids separated by comma e.g. 1,2,5,7
mysql_query("update ram set status=0 where emp_id in $empids");
//this will set all employee ids in one go..
}
$query = "SELECT * FROM `ram`";
$dd=mysql_query($query);
?>
<form action="" method="post" name="form">
<table border="1"><th>Username</th><th>Empid</th><th>Designation</th><th>Check box</th>
<?php
while( $row=mysql_fetch_array($dd))
{
?>
<tr>
<td><?php echo $row[0];?></td>
<td align="center"><?php echo $row[1];?></td>
<td align="center"> <?php echo $row[2];?> </td>
<td><input type="checkbox" id="chk[]" name="chk[]" value="<?php $row[1];?>"/></td>
</tr>
<?php } ?>
</table>
<table>
<tr>
<td> <input type="submit" name="submit" value="Activate" /></td>
<td> <input type="submit" name="submit" value="Deactivate" />
</tr></table>
</form>