I have php code which displays a table, the contents of which are displayed from a table in the database. One of the fields is a status field. There is a "Change" button which should change an "Inactive" status to "Active" and vice versa.
I need to know how to go about writing the code for the "change" button. Whether it should be written in jquery or it can be written in php also.
The code is as follows:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="indexStyle.css">
<title>User List</title>
</head>
<body>
<table border="2" bgcolor="#50D5CE">
<tr>
<td>SL. No</td>
<td>Name</td>
<td>Mobile Number</td>
<td>Status</td>
</tr>
<?php include ('header.php');
include ('includes/connect.php');
$dbconn = new connect();
$fields = "first_name,last_name,mobile_number,status";
$user_details = $dbconn->select($fields,"user_details","1");
$c=1;
for($i = 0; $i < count($user_details);$i++){
?>
<tr>
<td><?php echo $c ?></td>
<td><?php echo $user_details[$i][0]." ".$user_details[$i][1]; ?></td>
<td><?php echo $user_details[$i][2] ?></td>
<td><?php if($user_details[$i][3] == 0) {
echo "Inactive"; }
else echo "Active"; ?>
<input type="button" name="change_status" id ="change_status" value="Change"/></td>
</tr>
<?php $c++;
} ?>
</table>
</body>
</html>