I want to stop the continous fines in my codes after I click it and save it in database my problem is because if i click the button it's only save in the return.php but the counting is continuous every day like in the picture, I already try it but it didn't work
view_borrow.php
<div class="container">
<form method="POST" action="return_save.php">
<div class="margin-top">
<div class="row">
<div class="span12">
<div class="alert alert-info"><strong>Borrowed Books</strong></div>
<table cellpadding="0" cellspacing="0" border="0" class="table" id="example">
<thead>
<tr>
<th>Book title</th>
<th>Borrower</th>
<th>Type</th>
<th>Date Borrow</th>
<th>Due Date</th>
<th>Date Returned</th>
<th>Fines</th>
<th>Borrow Status</th>
</tr>
</thead>
<tbody>
<?php $user_query=mysqli_query($dbcon,"select * from borrow
LEFT JOIN member ON borrow.member_id = member.member_id
LEFT JOIN borrowdetails ON borrow.borrow_id = borrowdetails.borrow_id
LEFT JOIN book on borrowdetails.book_id = book.book_id
ORDER BY borrow.borrow_id DESC
")or die(mysqli_error());
while($row=mysqli_fetch_array($user_query)){
$currentdate = date('Y/m/d');
$start = new DateTime($returndate=$row['due_date']);
$end = new DateTime($currentdate);
$fines =0;
if(strtotime($currentdate) > strtotime($returndate)){
$days= $start->diff($end, true)->days;
$fines = $days > 0 ? intval(floor($days)) * 15 : 0;
$fi = $row['borrow_details_id'];
mysqli_query($dbcon,"update borrowdetails set fines='$fines' where borrow_details_id = '$fi'");
}
$id=$row['borrow_id'];
$book_id=$row['book_id'];
$borrow_details_id=$row['borrow_details_id'];
?>
<tr class="del<?php echo $id ?>">
<td class="test"><?php echo $row['book_title']; ?></td>
<td class="test"><?php echo $row['firstname']." ".$row['lastname']; ?></td>
<td class="test"><?php echo $row['type']; ?></td>
<td class="test"><?php echo $row['date_borrow']; ?></td>
<td class="test"><?php echo $row['due_date']; ?> </td>
<td class="test"><?php echo $row['date_return']; ?> </td>
<td class="test"><?php echo "₱ ".$fines; ?></td>
<td class="test"><?php echo $row['borrow_status'];?></td>
<td > <a rel="tooltip" title="Return" id="<?php echo $borrow_details_id; ?>"
href="#delete_book<?php echo $borrow_details_id; ?>" data-toggle="modal"
class="btn btn-success"><i class="icon-check icon-large"></i>Return</a>
<?php include('modal_return.php'); ?>
<td></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</form>
</div>
this is the modal where I click the return button
modal_return.php
<div id="delete_book<?php echo $borrow_details_id; ?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-body">
<div class="alert alert-success">Do you want to Return this Book?</div>
</div>
<div class="modal-footer">
<a class="btn btn-success" href="return_save.php<?php echo '?id='.$id; ?>&<?php echo 'book_id='.$book_id; ?>">Yes</a>
<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove icon-large"></i> Close</button>
</div>
</div>
This is the table
You're doing a date diff between $start and $end ($currentdate) but never using $returndate. PHP 7 has a null coalesce operator ?? that would be handy for your scenario (otherwise just use a normal if/else or its ternary equivalent ?:).
Your fees will always be from borrowdate to currentdate with your existing code. The code below should fix your issue.
$borrowdate = new Datetime($row['due_date']);
$currentdate = new Datetime();
$returndate = new Datetime($row['date_return']);
// PHP >= 7
$days = $borrowdate->diff($returndate ?? $currentdate, true)->days;
// PHP < 7
$days = $borrowdate->diff($returndate ?: $currentdate, true)->days;
Related
I have an HTML table that is populated by means of an array using foreach from an MVC MySql query. I am using class="clickable-row" in the table row to open a modal with the intention of updating any cells in that table row with new information that will then update the MySql database through a form. My problem is that, because the table is populated by foreach, when I click on a row, the modal is populated with the last row in the table's content. How do I get it to return the clicked rows content?
HTML
-->
<th>Update</th>
<th class="numeric-sort">Waybill</th>
<th>Date</th>
<th>Client</th>
<th>From</th>
<th>To</th>
<th>Supplier</th>
<th>Supplier Wb</th>
<th class="numeric-sort">Billable wght</th>
<th class="numeric-sort">Service</th>
<th>Pmnt method</th>
<th>Insurance</th>
<th class="numeric-sort">Desc</th>
<th>Cost net</th>
<th>Cost VAT</th>
<th>Cost Total</th>
<th>Sale</th>
<th>GP</th>
<th>Supplier Inv</th>
<th>Inv No.</th>
<th>POD.</th>
<th>Comp.</th>
</tr>
</thead>
<?php
foreach ($orderbook_infos as $orderbook_info) { ?>
<tr class='clickable-row' data-toggle="modal" data-target="#editModal" style="cursor:pointer">
<td><button class="btn btn-primary btn-sm">Update</button></td>
<td><?php echo $orderbook_info['order_id']; ?></td>
<td><?php echo mb_strimwidth($orderbook_info['date_added'], 0, 10); ?></td>
<td><?php echo $orderbook_info['payment_company']; ?></td>
<td><?php echo mb_strimwidth($orderbook_info['collection_city'], 0, 12); ?></td>
<td><?php echo mb_strimwidth($orderbook_info['delivery_city'], 0, 12); ?></td>
<td><?php echo "Seabourne"; ?></td>
<td><?php echo "400156784"; ?></td>
<td contenteditable><?php echo $orderbook_info['billable_weight']; ?></td>
<td><?php echo $orderbook_info['service_selected']; ?></td>
<td><?php echo $orderbook_info['payment_method']; ?></td>
<td><?php echo $orderbook_info['insured_value']; ?></td>
<td><?php echo $orderbook_info['package']; ?></td>
<td><?php echo "92.00"; ?></td>
<td><?php echo "123.00"; ?></td>
<td><?php echo "495.99"; ?></td>
<td><?php echo $orderbook_info['total']; ?></td>
<td><?php echo $orderbook_info['total'] - 92; ?></td>
<td><?php echo "SB123456"; ?></td>
<td><?php echo "425716"; ?></td>
<td><input type="checkbox" name="pod" /> </td>
<td><input type="checkbox" name="comp" /> </td>
</tr>
<?php } ?>
</table>
MODAL
<!-- Edit Job modal -->
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<a href="#" data-dismiss="modal"> <img src="images/arrow-back-512.png" width="30px" height="30px"> <small>Back</small>
</a> <span id="myModalLabel" style="margin-left:20px;"><font size="+2"><b>Update entry</b></font></span> </div>
<div class="modal-body">
<form class="form-horizontal" method="post" action="InsertPassportReminderSrvlt?idEmployee=1">
<fieldset id="modal_form">
<!-- Text input-->
<div class="form-group">
<!--<label class="col-md-4 control-label" for="textinput">Date Renewal Due</label>-->
<label class="col-md-4 control-label" for="textinput">Enter new number</label>
<div class="col-md-6">
<input name="dateRenewalDue" type="text" class="form-control input-md" value = "<?php echo $orderbook_info['order_id']; ?>">
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</fieldset>
</form>
</div>
</div>
</div>
You need create a jQuery code like this:
<script>
// When the modal is show
$('#editModal').on('show.bs.modal', function (event) {
var target = $(event.relatedTarget);
// Get the order_id from the attribute
var order_id = target.data('order-id');
var modal = $(this);
// Find the input from modal and put a value in it
modal.find('input[name=dateRenewalDue]').val(order_id);
})
</script>
In order to get order_id from our jQuery code. We need to add a data attribute on our tr tag
<tr class='clickable-row' data-toggle="modal" data-target="#editModal" data-order-id ="<?php echo $orderbook_info['order_id']; ?>" style="cursor:pointer">
Since we already add data-order-id into our tr tag. From jQuery we are able to get order id upon the modal is trigger
Bootstrap modal docs
i have this code that get data from db but it show only one row in table , another row it will show outside table
i want all data show in table
! this is my photo
and this is my code for connect to database
<?
session_start();
require('../config.php');
require('../data.php');
require('../fungsi.php');
functionUserLock();
$userStatus=$r["suspend"];
functionUserBlocked($userStatus);
include "head.php";
?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-red">
<div class="panel-heading">
<? echo $phname ; ?> History</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>
<center>Id Trx</center>
</th>
<th>
<center>Date</center>
</th>
<th>
<center>Amount</center>
</th>
<th>
<center>Pair</center>
</th>
<th>
<center>Not Pair</center>
</th>
<th>
<center>Available for
<? echo $skgh; ?>
</center>
</th>
<th>
<center>Stats</center>
</th>
<th colspan="2">
<center>Option</center>
</th>
</tr>
</thead>
<br>
<tbody>
and this is part of mycode ,it display in table but it display only one row , and another row is out of table
<?
$lole=$_COOKIE["username"];
$tabla = mysql_query("SELECT * FROM tb_ph where username='$lole' and status!='ditahan' ORDER BY id DESC limit 0,1000000");
while ($registro = mysql_fetch_array($tabla)) {
$yereka=$registro["verify"];
$perek=$registro["username"];
$pereka=$registro["id"];
$ferpax=$registro["id"];
$ferpaxd=$registro["username"];
$wedokan=$derekasu * $derekasur;
$hari = date("H");
$token=md5($frozenIdTrx.$hari);
echo "
<tr>
<td>". $registro["idtrx"] ."</td>
<td>". date("d M Y H:i:s A",$registro["date"]) ."</td>
<td>$matauang ". number_format($registro["paket"]) ." </td>
<td>$matauang ". number_format($derekc) ." </td>
<td>$matauang ". number_format($registro["saldo"]) ." </td>
<td>$matauang ". number_format($foolas) ." </td>
<td>". $mystats ."</td>
<td><div data-target=\"#DETAIL$ferpax\" data-toggle=\"modal\" class=\"btn btn-success btn-xs\" style=\"float:center;\"><center>DETAIL</center></div>
</td>
</tr>
";
?>
</tbody>
</table>
<div id="DETAIL<? echo $registro["id"]; ?>" tabindex="-1" role="dialog" aria-labelledby="modal-responsive-label" aria-hidden="true" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" data-dismiss="modal" aria-hidden="true" class="close">×</button>
<h4 id="modal-responsive-label" class="modal-title">Detail Transactions</h4></div>
<div class="modal-body">
<? echo showPhOrderMemberKananModal($ferpaxd,$ferpax); ?> <br>
<? echo showPhOrderMemberKananModalList($ferpaxd,$ferpax); ?>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default">Close</button>
</div>
</div>
</div>
</div>
</div>
<?
}
?>
<?
include "foot.php";
?>
I cant tell but it looks like you aren't closing your loop in the right place.
Also, Have you checked your raw query results to make sure you have more than one row returned?
<?
$lole=$_COOKIE["username"];
$tabla = mysql_query("SELECT * FROM tb_ph where username='$lole' and status!='ditahan' ORDER BY id DESC limit 0,1000000");
while ($registro = mysql_fetch_array($tabla)) {
$yereka=$registro["verify"];
$perek=$registro["username"];
$pereka=$registro["id"];
$ferpax=$registro["id"];
$ferpaxd=$registro["username"];
$wedokan=$derekasu * $derekasur;
$hari = date("H");
$token=md5($frozenIdTrx.$hari);
echo "
<tr>
<td>". $registro["idtrx"] ."</td>
<td>". date("d M Y H:i:s A",$registro["date"]) ."</td>
<td>$matauang ". number_format($registro["paket"]) ." </td>
<td>$matauang ". number_format($derekc) ." </td>
<td>$matauang ". number_format($registro["saldo"]) ." </td>
<td>$matauang ". number_format($foolas) ." </td>
<td>". $mystats ."</td>
<td><div data-target=\"#DETAIL$ferpax\" data-toggle=\"modal\" class=\"btn btn-success btn-xs\" style=\"float:center;\"><center>DETAIL</center></div>
</td>
</tr>
";
} // **<------- You need to close the loop here maybe....**
?>
</tbody>
</table>
<div id="DETAIL<? echo $registro["id"]; ?>" tabindex="-1" role="dialog" aria-labelledby="modal-responsive-label" aria-hidden="true" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" data-dismiss="modal" aria-hidden="true" class="close">×</button>
<h4 id="modal-responsive-label" class="modal-title">Detail Transactions</h4></div>
<div class="modal-body">
<? echo showPhOrderMemberKananModal($ferpaxd,$ferpax); ?> <br>
<? echo showPhOrderMemberKananModalList($ferpaxd,$ferpax); ?>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default">Close</button>
</div>
</div>
</div>
</div>
</div>
<?
} **// then remove this one i think**
?>
I am making a modal using looping data from the database on my project but I want to fetch all data in a database by selecting query GROUP BY color where id = modal id but my controller can't get the modal id which makes it error on selecting. please help me to fix it... thank you
this is the View code :
<table class="table table-bordered table-hover table table-sm" id="dataTable" width="100%" cellspacing="0">
<thead class="warna-header">
<tr>
<th rowspan="2" style="vertical-align:middle;text-align:center;">Tipe</th>
<th colspan="3" class="text-center bg-danger">1</th>
<th colspan="3" class="text-center bg-warning">2</th>
<th colspan="3" class="text-center bg-success">3</th>
<th rowspan="2" style="vertical-align:middle;text-align:center;" class="text-center">ACTION</th>
</tr>
</thead>
<tbody>
<?php foreach ($st_mobil as $st_mbl) : ?>
<tr>
<td style="font-size:12px;color:black;"><?php echo $st_mbl['jenismobil']; ?></td>
<td style="font-size:12px;color:black;text-align:center;"><?php echo $st_mbl['beli1']; ?></td>
<td style="font-size:12px;color`enter code here`:black;text-align:center;"><?php echo $st_mbl['jual1']; ?></td>
<td style="font-size:12px;color:black;text-align:center;"><?php echo $st_mbl['sisa1']; ?></td>
<td class="text-center">
<a href="" class="btn btn-success btn-sm view_detail" data-toggle="modal" title="Edit Data" data-target="#ViewStockMobilModal<?php echo $st_mbl['id']; ?>">
<span class="icon text-white-10">
<i class="fas fa-search"></i>
</span>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
-- Modal View
<?php foreach ($st_mobil as $st_mbl) : ?>
<div class="modal fade bd-example-modal-lg" id="ViewStockMobilModal<?php echo $st_mbl['id']; ?>" tabindex="-1" role="dialog"
aria-labelledby="ViewStockMobilModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header bg-primary">
<h5 class="modal-title" id="jenismobil" name="jenismobil">
<font color=white><?php echo $st_mbl['jenismobil']; ?></font>
</h5>
<button type="button" class="close text-white" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="table table-bordered table-striped table-sm">
<thead class="btn-primary">
<tr>
<th style="font-size:12px;" class="text-center bg-danger">ST</th>
<th style="font-size:12px;" class="text-center bg-danger">BK</th>
<th style="font-size:12px;" class="text-center bg-danger">BJ</th>
</tr>
</thead>
<?php foreach($view_detail as $vdt) : ?>
<tbody>
<tr>
<td style="font-size:12px;color:black;"><?php echo $vdt['warna']; ?></td>
<td style="font-size:12px;color:black;text-align:center;"><?php echo $vdt['st_in_1']; ?></td>
<td style="font-size:12px;color:black;text-align:center;"><?php echo $vdt['st_out_1']; ?></td>
</tr>
</tbody>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
This is the controller :
$data['st_mobil'] = $this->db->get('st_mobil')->result_array();
$id = $this->input->get($id); // i want to get the id of my modal
$data['view_detail'] = $this->stock_model->get_view_modal($id);
This is my model :
public function get_view_modal($id)
{
$query = "SELECT `id`,`jenismobil`,`warna`,`st_in_1`,`st_out_1`,`st_sisa_1`,`st_in_2`,`st_out_2`,`st_sisa_2`,`st_in_3`,`st_out_3`, st_sisa_3`
FROM `st_mobil`
GROUP BY `warna`
WHERE `id` = '$id'
";
return $this->db->query($query)->result_array();
}
When you getting the id
$id = $this->input->get('id'); // this should corrected like this.
I have a table that list Employee Leave record and status. Each record has a unique leave id. I want to view each row's leave id and status by clicking the 'View' modal button. However, all buttons display the first row data from the database. How do I make each button corresponds to its leave id number on every row. Please help. I'm super newbie here. LOL. Any help would be greatly appreciated. Thanks in advance.
<!DOCTYPE html>
<html>
<h2>Employee Leaves</h2>
<?php
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password ="";
$mysql_database = "employeerecord";
// Create connection
$conn = new mysqli($mysql_hostname, $mysql_user, $mysql_password, $mysql_database);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sqli = "SELECT emp_id, leave_id, last_name, first_name, leave_type, start_date, end_date, comment, date_filed, time_filed, status FROM leaves";
$result = $conn->query($sqli);
if ($result->num_rows > 0) { ?>
<table class="table">
<thead>
<tr>
<th>ID Number</th>
<th>Lastname</th>
<th>Firstname</th>
<th>Leave Type</th>
<th>Start Date</th>
<th>End Date</th>
<th>Comment</th>
<th>Date Filed</th>
<th>Time Filed</th>
<th>Status</th>
<th>Leave ID</th>
<th></th>
</tr>
</thead>
<?php
// output data of each row
while($row = $result->fetch_assoc())
{ ?>
<tbody>
<tr>
<td>
<?php echo $row["emp_id"]; ?>
</td>
<td>
<?php echo $row["last_name"]; ?>
</td>
<td>
<?php echo $row["first_name"]; ?>
</td>
<td>
<?php echo $row["leave_type"]; ?>
</td>
<td>
<?php echo $row["start_date"]; ?>
</td>
<td>
<?php echo $row["end_date"]; ?>
</td>
<td>
<?php echo $row["comment"]; ?>
</td>
<td>
<?php echo $row["date_filed"]; ?>
<td>
<?php echo $row["time_filed"]; ?>
</td>
<td>
<?php echo $row["status"]; ?>
</td>
<td>
<?php
$leavestatus = $row["status"];
$leaveid = $row["leave_id"];
echo $leaveid;
?>
</td>
<td>
<button type="button" name="<?php $leaveid; ?>" class="btn btn-default" data-toggle="modal" data-target="#myModal">View</button>
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Update Leave</h4>
</div>
<div class="modal-body">
<p>Leave ID:<?php echo $leaveid; ?></p>
<p>Leave Status:<?php echo $leavestatus; ?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
<?php }
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
</html>
First, put the tbody tag outside that while loop:
while($row = $result->fetch_assoc())
{ ?>
<tbody>
<tr>
<td>
<?php echo $row["emp_id"]; ?>
</td>
<td>
</td>
</tr>
</tbody>
<?php }
should be:
while($row = $result->fetch_assoc())
{ ?>
<tr>
<td>
<?php echo $row["emp_id"]; ?>
</td>
<td>
</td>
</tr>
<?php }
Also the ID of the modal needs to match the property of the button revealing it:
<button type="button" name="<?php $leaveid; ?>" class="btn btn-default" data-toggle="modal" data-target="#myModal_<?php $leaveid; ?>">View</button>
<div class="modal fade" id="myModal_<?php $leaveid; ?>" role="dialog">
Give that a shot!
Best of Luck!
All of your modals have the same id. So the first one will get called when any button is clicked. Try this:
<button type="button" name="<?php echo $leaveid; ?>" class="btn btn-default" data-toggle="modal" data-target="#myModal-<?php echo $leaveid; ?>">View</button>
(also, you are missing the echo statement on your button name)
and
<div class="modal fade" id="myModal-<?php echo $leaveid; ?>" role="dialog">
Or better yet, just have one modal that is outside the loop and use jQuery to populate it when any button is clicked.
I have displayed a table of records using the php while loop.
Also, each row has a corresponding button which is the delete and edit button. I used a certain bootstrap modal for the buttons.
the form is linked to another page
(specifically, success.php?id=)
with the intention of passing the ID of a specific row through its URL. But my problem is that the ID passed will always be the ID of the First row.
so here's the code of my table.
<?php
$sql = mysql_query("SELECT *
FROM foreignlanguage
INNER JOIN sched
ON sched.sched_id = foreignlanguage.schedID
WHERE sched.type='Group' and foreignlanguage.Subject = 'Italian' and
sched.del='1' and (foreignlanguage.area = 'A1' OR foreignlanguage.area = 'A2' OR foreignlanguage.area = 'A3' OR foreignlanguage.area = 'A4' OR foreignlanguage.area = 'A5')");
$count = mysql_num_rows($sql);
if($count != 0)
{
?>
<table class="table table-striped table-hover table-bordered" id="editable-sample">
<thead>
<tr>
<th><div style="width: 45px" >Level</div></th>
<th><div style="width: 60px" >Days</div></th>
<th><div style="width: 70px" >Time</div></th>
<th><div style="width: 90px" >Teacher</div></th>
<th><div style="width: 10px" >Room</div></th>
<th><div style="width: 10px" >Hours</div></th>
<th><div style="width: 15px" >Price</div></th>
<th><div style="width: 10px" >Options</div></th>
</tr>
</thead>
<tbody>
<?php
while( $get_row = mysql_fetch_assoc($sql))
{
$iClass = $get_row['sched_id'];
$iDay = $get_row['day'];
$iTime = $get_row['time'];
$iTeacher = $get_row['teacher'];
$iRoom = $get_row['room'];
$iHour = $get_row['hour'];
$iPrice = $get_row['price'];
$iLevel = $get_row['area'];
$del = $get_row['del'];
?>
<tr class="">
<td><?php echo $iLevel; ?></td>
<td><?php echo $iDay; ?></td>
<td><?php echo $iTime; ?></td>
<td><?php echo $iTeacher; ?></td>
<td><?php echo $iRoom; ?></td>
<td><?php echo $iHour; ?></td>
<td><?php echo $iPrice; ?></td>
<td>
<!-- Delete MODAL-->
<?php
if(isset($_POST['Delete']))
{
header("Location: success.php");
}
?>
<i class="icon-remove icon-white"></i> Delete
<div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-labelledby="delModal" aria-hidden="true">
<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" id="myModalLabel">Delete Schedule</h4>
</div>
<div class="modal-body">
<!--try-->
Are you sure that you want to delete this schedule?
<!--/try-->
</div>
<div class="modal-footer">
<form method='post' action='success.php?id=<?php echo $iClass; ?>' class="form-horizontal">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="submit" class="btn btn-danger" name="Delete" value="Delete">
</form>
</div>
</div>
</div>
</div>
<!-- END DELETE MODAL -->
</td>
</tr>
<?php
}
}
else
{
echo "<h4>There are no schedules available yet</h4>";
}
?>
</tbody>
</table>
and here's for the linked page.
<?php include('includes/init.php');
$del_this = $_GET['id'];
$delsched = mysql_query(" UPDATE sched SET del = '0' WHERE sched_id = '$del_this' ") or die(mysql_error("ERROR"));
$delsched_list = mysql_query("UPDATE sched_list SET val = '0' WHERE sched_id = '$del_this' ") or die(mysql_error("ERROR"));
echo $del_this;
header("Location: admin-foreign.php");
?>
pls help me.
There are a number of ways of doing it. You need to have unique ids for your buttons anyway so you may as well have them as Id="EditButton".$rowid and similarly for delete