I am trying to delete a field in my html table. When I click on the delete button I redirect the user to a popup window asking if they are sure if they want to delete that line in the table. Once they click yes it takes them to a delete.php file which deletes it from our database. I am not sure how I can send this value to our delete.php file.
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>User Name</th>
<th>Distinct Items</th>
<th>Total Occurrences</th>
<th>Last Occurrence</th>
<th>Environment</th>
<th>Control</th>
</tr>
</thead>
<tbody>
<?php
include ("config.php");
$sql = "SELECT * FROM newTable";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
echo '<tr>';
echo '<td>'. $row['account_id'] . '</td>';
echo '<td>'. $row['user'] . '</td>';
echo '<td>'. $row['pass'] . '</td>';
echo '<td>'. $row['privs'] . '</td>';
echo '<td>'. $row['privValue'] . '</td>';
echo '<td>';
echo '<i class="fa fa-pencil"></i>';
echo '<i class="fa fa-trash-o "></i>';
echo '</td>';
echo '</tr>';
}
?>
<!-- Modal_delete HTML -->
<div id="Modal_delete" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Delete User</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to delete this user?</p>
</div>
<form action="delete_user.php" method="post">
<input type="hidden" name="id" value="<?php echo $id;?>"/>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-danger">Delete</button>
</div>
</form>
</div>
</div>
</div>
The problem is to create the delete button I am referencing an html subroutine to create that the popup once that is clicked. How can I send the the table data to my delete.php file?
<?php
include ("test.php");
$tbl_name="newTable"; // Table name
$id = $_POST['id'];
echo $_POST['id'];
echo "$id";
// To protect MySQL injection (more detail about MySQL injection)
$sql="DELETE FROM tbl_name WHERE account_id='$id';";
mysql_query(sql);
header("Location: adminUser.php");
?>
Are you opposed to using jquery? (And sorry, I would ask that in a comment beforehand, but, tsk, not enough reputation, so here's my whole answer :) The following would be very simple:
$('.btn-danger').click(function(event) {
$('#Modal_delete').css('display', 'initial'); // swap this for however you're showing your delete confirmation popup. I just had it for testing.
var rowToDeleteID = $(event.currentTarget).parents('tr').attr('id'); // you'd need to add a unique id to each table row for this to work.
$('input[type="hidden"]').val(rowToDeleteID);
});
Of course, this would be much more robust (in fact, depending on your other code, it might only work [not to mention it's just a good idea]) if you add unique identifiers to the delete buttons (the a tags with fa-trash-o icons) and your hidden input field.
You can use the $row['account_id'] as an attribute in the link #Modal_delete and get it with jQuery..
<i class="fa fa-trash-o "></i>
$("a[href='#Modal_delete']").on("click", function(e) {
$("input[name='id']").val($(this).data("account-id"));
});
Related
I'm currently working on a project that envolves me using a admin dashboard. As apart of this i need to be able to display all users in the database and then edit them.
I want to be able to open the modal to edit the users, but whenever i open the modal its displaying the first entries data. How can i change this to display the different data for each line and then edit said data.
This is my current Code
<?php
include_once '../dashboard/dashHeader.php';
?>
<section>
<table class="table table-striped" style="border: 3px solid;">
<thead>
<tr>
<th>UID</th>
<th>Full Name</th>
<th>Email</th>
<th>User Name</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
include_once('../../includes/dbh.inc.php');
$sql = "SELECT * FROM users ORDER by usersId";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($result)){
if ($row['type'] == 1) {
$role = "Admin";
} else {
$role = "User";
}
echo "<tr>";
echo "<td>".$row['usersId']."</td>";
echo "<td>".$row['usersName']."</td>";
echo "<td>".$row['usersEmail']."</td>";
echo "<td>".$row['usersUid']."</td>";
echo "<td>".$role."</td>";
echo '<td>
<button type="button" class="btn btn-link btn-sm btn-rounded" data-mdb-toggle="modal" data-mdb-target="#exampleModal">
Edit
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Editing: '.$row['usersUid'].'</h5>
</div>
<div class="modal-body">...</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-mdb-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
</td>';
echo "</tr>";
}
?>
</tbody>
</table>
</section>
<?php
include_once '../dashboard/dashFooter.php';
?>
Without seeing what your JavaScript is doing, it's hard to debug
But first...
... you really need to fix the security of this page. This is vulnerable to HTML injection. You MUST escape all dynamic content (eg from your database), otherwise at best you will show mangled data, at worst you make it easy for a hacker to inject any code they like into your web page. At a minimum you should be running htmlspecialchars().
Ex echo "<td>".htmlspecialchars($row['usersName'])."</td>";
Why I can't get the ID from a row in table when I click Pending
Here is the code:
<!-- ############################################################################################################################################################################################################ -->
<!-- TABLE BUSINESS -->
<div class="row" id="TblBiz" style="display: none;">
<div class="col" style="height: 71px;">
<h1 style="font-family: Roboto, sans-serif; font-weight: 300;">Business</h1>
</div>
<div class="col-md-8 offset-md-2">
<div class="panel" id="main">
<div class="container-fluid container-bg">
<div class="table-responsive">
<table id="myTable4" class="table table-hover table-dark" style="font-size:11px; margin-top:6px;">
<thead style="font-size: 18px;">
<th>#</th>
<th>Business ID</th>
<th>Name</th>
<th>Owner</th>
<th>View</th>
<th>Approval</th>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM mechanic_business";
$result = mysqli_query($connect, $sql);
if(mysqli_num_rows($result) > 0){
$i = 1;
while ($row = mysqli_fetch_assoc($result)) {
$biz_ID = $row['businessID'];
$mech_ID = $row['mechID'];
$mech_name = $row['mech_name'];
$bizName = $row['business_name'];
$bizApprove = $row['business_approval_status'];
$bizStatus = $row['business_status'];
// $dateJoin = $row['DATE_REGISTERED'];
// $dateFormated = date("d M Y", strtotime($dateJoin));
// Color class in PHP color(Pending, Approved, Banned)
$color = ($bizApprove === 'Pending') ? '#f0ad4e' : (($bizApprove === 'Approved') ? '#28a745' : '#dc3545');
echo "<tr style='font-size:18px;'>";
echo "<td class='align-middle'>" . $i; $i++ . "</td>";
echo "<td class='align-middle'>" . $biz_ID . "</td>";
echo "<td class='align-middle'>". $bizName ."</td>";
echo "<td class='align-middle'>". $mech_name ."</td>";
echo "<td class='align-middle'><input type='button' name='view' value='view' id='". $biz_ID ."' class='btn btn-info btn-xs view_biz'></td>";
echo "<td class='align-middle'><a role='button' class='approval-bton' id='". $biz_ID ."' style='color:". $color ."';>". $bizApprove ."</a></td>";
echo "</tr>";
}
} else {
echo "<tr>";
echo "<td colspan='7' class='table-active align-middle'>No Record in Database</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- ############################################################################################################################################################################################################ -->
<!-- ############################################################################################################################################ -->
<!-- UPDATE APPROVE STATUS MODAL -->
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"> Update Business Approval Status </h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="" method="post" enctype="multipart/form-data">
<div class="modal-body">
<input type="text" name="businessID" id="" value="<?php echo $biz_ID; ?>">
<div class="form-group">
<div>
<small id="photoHelp" class="form-text text-muted"><span style="color: #FF0000;">*</span><em>320px x 320px is ideal dimension, Format: jpg, png, jpeg, and PDF only</em></small>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" name="updateApprove" class="btn btn-primary">Save Change</button>
</div>
</form>
</div>
</div>
</div>
<!-- ############################################################################################################################################ -->
When I clicked a Pending from each row it suppose to get their ID based on the database but when I clicked from each row they display the same ID as shown picture in the link below.
https://drive.google.com/file/d/1IcfDUs3Q8Wl5vVO3KF793M5noTukLrCL/view?usp=sharing
They both show ORVA01BIZ-00000002 but in database first row is ORVA01BIZ-00000001 and ORVA01BIZ-00000002 is the second row and goes on.
There is very simple logic.
first, your model is not in loop so you can't pass $biz_ID in the model if you want to get each id from the database.
When the loop ends then it will only print the last row biz_id in the model.
The solution is :-
Changes you have to do in your code
You have to do one thing if you want to get each id
This is your second td :-
echo "<td class='align-middle bizzid'>" . $biz_ID . "</td>";
In your model you have to paste this : -
<input type="text" name="businessID" id="businessID" value="">-
This jquery code can help you to get desired result.
var bizid = $(this).closest('tr').find('.bizzid').text();
$('#businessID').val(bizid);
$('#approveModal').modal('show');
});'
Okay, got it
I did what you asked #Gurpreet Kait it really workss.
I put the jquery code inside the initialize modal bootstrap
// Show Modal 1
$(document).ready(function () {
$('.approval-bton').on('click', function() {
var bizid = $(this).closest('tr').find('.bizzid').text();
$('#businessID').val(bizid);
$('#approveModal').modal('show');
});
Thank you very much #Gurpreet Kait for your help.
});
Good day! I have a jquery and bootstrap 4 datatable with pagination and a delete button at each row but after the page 1 is full of data it will go to page 2. The problem is the data in page 2 with a delete button row is not working but in page 1 the delete button works perfectly..
Here's my table code:
<table class="table table-hover table-bordered" id="questionTable">
<thead>
<tr>
<th>No.</th>
<th>Student</th>
<th>Subject Code</th>
<th>Semester</th>
<th>SchoolYear</th>
<th>Professor</th>
<th></th>
</tr>
</thead>
<tbody>
<?php while ($row = $result -> fetch_object()): ?>
<tr>
<td><?php echo $row->Subject_Student_Taken;?></td>
<td><?php echo $row-> Student_ID;?></td>
<td><?php echo $row-> Subject_Code;?></td>
<td><?php echo $row-> Term_Name;?></td>
<td><?php echo $row-> SY_Name;?></td>
<td><?php echo $row-> Faculty_ID;?></td>
<td class="text-center">
<a class="btn btn-sm btn-outline-primary text-muted" href="SubjectTaken_edit.php?Subject_Student_Taken=<?php echo $row->Subject_Student_Taken;?>">Edit</a>
<a data-fid="<?php echo $row->Subject_Student_Taken;?>" title="Delete Faculty" data-toggle="modal" data-target="#delete_modal" class="btn btn-sm btn-outline-danger delete-faculty-btn text-muted" >Delete</a>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
Here's my delete code:
if(!empty($_POST['delete'])) {
$id = $_POST['delete'];
$data->delete_StudentTakenHandle($id, $conn);
}
Function code:
function delete_StudentTakenHandle($id, $conn){
$sql = "DELETE FROM subject_taken_handle WHERE Subject_Student_Taken=? ";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $id);
$stmt->execute();
}
Modal code:
<div class="modal fade" id="delete_modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Delete Confirmaiton</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<div class="alert alert-danger" role="alert">
Are you sure you want to delete selected record?
</div>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<input type="hidden" name="delete" id="row-id-to-delete">
<button type="submit" class="btn btn-danger" >Yes</button>
</div>
</div>
</div>
</div>
And here's my jquery code:
<script>
$('.delete-faculty-btn').on('click',function(){
$("#row-id-to-delete").val($(this).data('fid'));
});
</script>
The error is, most likely, caused by this:
only the elements from the first page are displayed (existing) when you set your jQuery event.
Since the jQuery.on function attaches events only to existing elements, the event is not attached to elements from other pages.
Solution:
You should use the table's click event as a wrapper for attaching events to delete buttons.
This way, each time you click and change the page, delete buttons will exist, and the jQuery.on function will be able to attach event for delete to them.
You should wrap your event attach code like this:
$("#questionTable").on("click", ".delete-faculty-button", function(){
// attach your delete event here
});
Read more in the documentation of jQuery.on.
Use the delegated format of on instead of click..on() | jQuery API Documentation
$('.delete-faculty-btn').on('click',function(){
$("#row-id-to-delete").val($(this).data('fid'));
});
becomes:
$(document).on("click", ".delete-faculty-btn", function () {
$("#row-id-to-delete").val($(this).data('fid'));
});
I have a PHP file manage-users.php which contains bootstrap Data-table. Which shows data from MySQL users Table .
code of Data-table is :
<table id="myTable" class="table table-striped table-hover">
<thead>
<tr>
<th>
<span class="custom-checkbox">
<input type="checkbox" id="selectAll">
<label for="selectAll"></label>
</span>
</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Phone</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$result = mysqli_query($conn,"SELECT * FROM users") or die("Unable to qet all users data " . mysqli_error($conn));
while ($row = mysqli_fetch_assoc($result)) {
echo "<tr>";
echo '<td>
<span class="custom-checkbox">
<input type="checkbox" id="checkbox1" name="options[]" value="1">
<label for="checkbox1"></label>
</span>
</td>';
echo "<td>".$row['FIRST_NAME']."</td>";
echo "<td>".$row['LAST_NAME']."</td>";
echo "<td>".$row['EMAIL']."</td>";
echo "<td>".$row['PHONE']."</td>";
echo '
<td>
<i class="material-icons" data-toggle="tooltip" title="Edit"></i>
<i class="material-icons" data-toggle="tooltip" title="Delete"></i>
</td>
';
echo "</tr>";
}
?>
</tbody>
</table>
In the same page, I have two bootstrap modals to delete and edit data .
I'm working on Delete now.
Delete Modal Code is :
<div id="deleteEmployeeModal<?php echo $row['USER_ID']; ?>" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form>
<div class="modal-header">
<h4 class="modal-title">Delete User</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete these Records?</p>
<p class="text-warning"><small>This action cannot be undone.</small></p>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<button class="btn btn-danger">Delete</button>
</div>
</form>
</div>
</div>
</div>
Now the problem is that, that i can not delete data because in Delete Modal the $row['USER_ID] is empty. there is no problem in retrieving data from the server because the $row['USER_ID] is showing showing on every user specific delete button. what should i do now ?
If question needs more explanation, i'll explain.
Upon opening the modal, you basically set a hidden field so that when you submit the form, it will send delete_user_data.php?id=YOUR-VALUE.
1) Store the ID in the HTML. A good place might be the link that opens the modal. Also, remove data-toggle attribute because we will be opening the modal dynamically.
echo '<i class="material-icons" data-toggle="tooltip" title="Delete"></i>';
2) Only use one modal for deleting.
<div id="deleteEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<!-- give your form an action and method -->
<form action="delete_user_data.php" method="GET">
<div class="modal-header">
<h4 class="modal-title">Delete User</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete these Records?</p>
<p class="text-warning"><small>This action cannot be undone.</small></p>
</div>
<div class="modal-footer">
<!-- add a hidden input field to store ID for next step -->
<input type="hidden" name="id" value="" />
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<!-- change your delete link to a submit button -->
<button class="btn btn-danger" type="submit">Delete</button>
</div>
</form>
</div>
</div>
</div>
3) Open the modal dynamically.
$(function () {
$('a.delete').click(function (e) {
e.preventDefault();
var link = this;
var deleteModal = $("#deleteEmployeeModal");
// store the ID inside the modal's form
deleteModal.find('input[name=id]').val(link.dataset.id);
// open modal
deleteModal.modal();
});
});
Use similar approach for doing the Edit modal.
Table:
<table class="table table-bordered">
<thead>
<tr>
<th>Works At</th>
<th>First Name</th>
<th>Middle Initial</th>
<th>Last Name</th>
<th>Start Date</th>
<th>SSN#</th>
<th>Modify</th>
</tr>
</thead>
<?php
$query = "SELECT * FROM employees";
$stmt = $db->prepare($query);
$stmt->execute();
foreach ($stmt as $row): ?>
<tr>
<td><?php echo $row['rest_id_employees']; ?></td>
<td><?php echo $row['fname']; ?></td>
<td><?php echo $row['minit']; ?></td>
<td><?php echo $row['lname']; ?></td>
<td><?php echo $row['start_date']; ?></td>
<td><?php echo $row['ssn']; ?></td>
<td style="text-align: center">
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn btn-danger" href="<?php echo $_SERVER['PHP_SELF'].'?ssn='.urlencode($row['ssn']); ?>#delModal" data-toggle="modal"><i class="icon-trash icon-white"></i> Delete</a>
<a class="btn btn-warning" href="#editModal"><i class="icon-wrench icon-white"></i> Edit</a>
</div>
</div>
</td>
</tr>
<?php endforeach; ?>
</table>
My goal is to pass the value of $row['ssn'] into my #delModal. I assume the problem lies within:
<a class="btn btn-danger" href="<?php echo $_SERVER['PHP_SELF'].'?ssn='.urlencode($row['ssn']); ?>#delModal" data-toggle="modal"><i class="icon-trash icon-white"></i> Delete</a>
It is my understanding that with the above syntax I should be able to use $_GET['ssn'] inside the Bootstrap Modal to pull the value, but when I var_dump($ssn) the value only NULL is printed.
Here is the Modal:
<div class="modal hide" id="delModal" aria-hidden="true">
<div class="modal-header">
<h3 style="color: red">WARNING</h3>
</div>
<div class="modal-body">
<?php
$ssn = $_GET['ssn'];
var_dump($ssn);
?>
<h4>You are about to delete --- from your Employee database.</h4>
<p>An employee cannot be recoverd once they have been deleted. They can be added to the system again, but
all data about the employee will be lost if you delete them. Are you sure you mean to delete this
employee from the database?</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<a class="btn btn-danger" href="deleteemployee.php?ssn=<?php echo urlencode($ssn); ?>"><i class="icon-trash icon-white"></i> Delete</a>
</div>
</div>
The overall purpose of this implementation is to use the Modal as a means to not accidentally delete an employee by prompting the user with a warning. I cannot just use $row within the Modal as it will pull the last row every time, and I'm sure there's a better way of achieving what I'm trying to do than what I'm trying to do here, but I'm not sure what that way is.
Hello I had the same issue and almost the same code as you are using. But I able to solve that issue later by passing my parameter value as href id.
I had a button named READ, to open my model window. Here is the HTML code for my button.
<a button type="button" href="#<?php echo''.$u_id.'';?>" data-toggle="modal" class="btn btn-primary"> READ </a>
Here in that above code, you can see i have used id(column name and the primary key) of the message as the href id!
And here is the my code for MODEL WINDOW
<div class="modal" id="<?php echo''.$u_id.'';?>">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">Create public Event</h4>
</div>
<div class="modal-body">
<?php echo '.$u_id.';?>
</div>
</div>
</div>
so once I passed the id (parameter) in to the modal, I can get other values using simple sql query.
So for your code also, i'm suggesting you to pass your primary key column value (Eg:id) as the button href id and div id.
the best way is to use Jquery Ajax call
like the following step: -
1. Create a function which get a parameter (or more).
2. Which is use to process Ajax post method.
3. And on return print HTML data in the modal div.
4. Call that function along with modal button "onClick" event...
And rest will be done easily the best and simple way to do that
http://infotonicsmedia.com
I was faced with a simular situation.
My solution was:
private function pri_show_weekcontent($p_sCourse){
for($iWeekcounter=1;$iWeekcounter<=10;$iWeekcounter++){
// Fetch the nesseray data from the database
$aCellContent = $this->fetchAssignmentscontents($p_sCourse,$iWeekcounter);
// Create an unique ID for the modal, in my case course+weeknumber
echo("<div id='".$p_sCourse.$iWeekcounter."' class='modal fade' role='dialog'>");
// Build the modal
echo("<div class='modal-dialog'>");
echo("<div class='modal-content'>");
echo("<div class='modal-header'>");
echo("<button type='button' class='close' data-dismiss='modal'>×</button>");
echo("<h4 class='modal-title'>Toelichting opdracht</h4>");
echo("</div>");
echo("<div class='modal-body'>");
// show the content from the database
echo("<p>".$aCellContent[0][6]."</p>");
echo("</div>");
echo("<div class='modal-footer'>");
echo("<button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>");
echo("</div>");
echo("</div>");
echo("</div>");
echo("</div>");
if(!empty($aCellContent)){
if($_SESSION['verifiedUser']=='true'){echo("<td align='center' width='8%' bgcolor='white'><a href='editassignment.php?rn=".$aCellContent[0][0]."'><span title='".$aCellContent[0][6]."'>".$aCellContent[0][5]."</span></a></td>"); }
// call the unique ID model with a click.
else{echo("<td align='center' width='8%' bgcolor='white'><a data-toggle='modal' data-target='#".$p_sCourse.$iWeekcounter."'>".$aCellContent[0][5]."</a></td>");}
}else{
if($_SESSION['verifiedUser']=='true'){echo("<td align='center' width='8%' bgcolor='lightgreen'><a href='addassignment2.php?cn=".$_SESSION['sClassname']."&oo=".$p_sCourse."&pn=".$_SESSION['iPeriodNumber']."&wn=".$iWeekcounter."'>Geen huiswerk</a></td>");}
else{echo("<td align='center' width='8%'> </td>");}
}
}
}
Rather than passing value as get directly echo your values in model, and get an advantage of both being in same file.
call your model like this
<a class="btn btn-danger" href="#delModal" data-toggle="modal"><i class="icon-trash icon-white"></i> Delete</a>
In model try like this
<div class="modal hide" id="delModal" aria-hidden="true">
<div class="modal-header">
<h3 style="color: red">WARNING</h3>
</div>
<div class="modal-body">
<?php echo $row['ssn']; ?>
<h4>You are about to delete --- from your Employee database.</h4>
<p>An employee cannot be recovered once they have been deleted. They can be added to the system again, but
all data about the employee will be lost if you delete them. Are you sure you mean to delete this
employee from the database?</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<a class="btn btn-danger" href="deleteemployee.php?ssn=<?php echo urlencode($ssn); ?>"><i class="icon-trash icon-white"></i> Delete</a>
</div>
</div>
Hope this helps.