Dear All,
I have a dynamic javascrip table for sort and filtering a data which contains 4 rows: Fullname, Companyname, address and email. Everything is working fine with loading the data from mysql database. I have added two actions to the table (view user and delete user). the view user button is working but I need the delete user button to open a modal and confirm the delete of the user selected. I have create the modal and is working but can't get the UserID value. I need your help please. Thank you.
Please find below the code:
<?php
while ($row = mysqli_fetch_assoc($results)) {
echo "<tr>";
echo "<td>" . $row['Fullname'] . "</td>";
echo "<td>" . $row['Companyname'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo '<td><a href="index.php?action=viewuser&userID=' . $row['userID'] . '"><i class="fa fa-edit text-info" data-toggle="tooltip" data-placement="left" title="View User"></i></a>
<a href="#deleteuser" data-toggle="modal"><i class="fa fa-trash-o text-danger" data-toggle="tooltip" data-placement="left" title="Delete"></i></a>
echo "</tr>";
}
}
echo "</table>";
?>
<!-- Modal_Open -->
<div class="modal fade" id="deleteuser<?php echo $row['userID']; ?>" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form action="" method="post">
<div class="modal-body">
<p class="lead"><?php echo $deleteUserConf.' '.clean($row['userName']); ?>?</p>
</div>
<div class="modal-footer">
<input name="userID" type="hidden" value="<?php echo $row['userID']; ?>" />
<button type="input" name="submit" value="deleteuser" class="btn btn-success btn-icon"><i class="fa fa-check-square-o"></i> <?php echo $yesBtn; ?></button>
<button type="button" class="btn btn-default btn-icon" data-dismiss="modal"><i class="fa fa-times-circle-o"></i> <?php echo $cancelBtn; ?></button>
</div>
</form>
</div>
</div>
</div>