php table show data from mysql drop down selection - php

simply I have two tables: Course_table and Major_table, and they both have relationship entity. I have created a drop down list and linked it to the Major_table, and an html table linked it to the Course_table. What I want to do is display data on the Course_table based on the selection from the drop down list, but when I select something and press 'Filter' it shows an empty table.
Here is my first code:
<form method="post" action="staff-page.php">
<label for="majorFilter">Select Major: <select id="majorFilter" name="majorFilter">
<option value="0">Select a major</option>
<?php
include ('partials/connectDb.php');
$sql = "SELECT * FROM major_table;";
$run_query = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($run_query)) {
$m_id = $row['major_id'];
$m_name = $row['major_name'];
echo "<option value='{$m_id}'>{$m_name}</option>";
}
?>
</select></label>
<Button type="button" name="filter" id="filter">Filter</Button>
</form>
And this is my second code:
<table style="height: 400px; width: 600px; overflow: auto; display: none;" id="courseTable">
<caption>Course Table</caption>
<thead>
<tr>
<th>Name</th>
<th>Code</th>
<th style="padding-right: 10px;">Cr</th>
<th>Major</th>
<th>Students Enrolled</th>
</tr>
</thead>
<?php
error_reporting(0);
$conn = mysqli_connect('localhost', 'root', '', 'srs-db') or die('ERROR: Cannot Connect='.mysql_error($conn));
$query = "SELECT course_table.course_name, course_table.course_code, course_table.cr, major_table.major_name, course_table.students_enrolled FROM course_table
INNER JOIN major_table ON course_table.major = major_table.major_id
WHERE course_table.major = '$m_id';";
$sql = mysqli_query($conn, $query);
while ($course = mysqli_fetch_array($sql)) {
# code...
echo "<tr>";
echo "<td>.$course[course_name].</td>";
echo "<td>.$course[course_code].</td>";
echo "<td>.$course[cr].</td>";
echo "<td>.$course[major_name].</td>";
echo "<td>.$course[students_enrolled].</td>";
echo "</tr>";
}
?>
</table>
Your help is much appreciated :)

In your second code, you need to make your <tr> id based and apply a class for all of them. like this:
while ($course = mysqli_fetch_array($sql)) {
# code...
echo "<tr class='all_trs' id='display_".$m_id."' style='display:none;'>";
echo "<td>.$course[course_name].</td>";
echo "<td>.$course[course_code].</td>";
echo "<td>.$course[cr].</td>";
echo "<td>.$course[major_name].</td>";
echo "<td>.$course[students_enrolled].</td>";
echo "</tr>";
}
And then you need to place a JQuery Onchange method in Document ready:
<script type="text/javascript">
$(function() {
// will be triggered on Change of your Select box
$( "#majorFilter" ).change(function() {
alert("Select Box changed");
// Hiding all Trs by default.
$( ".all_trs" ).hide();
// Showing just the specific TR which is selected in select box
$( "#display_" + $(this).val() ).show();
});
});
</script>
You might notice, that I have used display:none for echoing the <tr> html, it is because, I'm hiding all the TRs by default and will display only the selected one on Select Box change.

Related

Populating form from table row

I have added a button at the end of the row of my datatable intended to update the information in the database for the specific row chosen.
When I click the update button, a form pops us with the relevant fields to update.
Ideally, I would like the form to be autopopulated with the information from the table row which I have chosen to update
Code...
Table:
<div class="viewalljob tab-pane show active" id="profile" role="tabpanel" aria-labelledby="profile-tab">
<h2>Edit Job Table</h2>
<table id="edit-job-table" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th class="job_id">ID</th>
<th class="job_date">Date</th>
<th class="job_company">Company Name</th>
<th class="job_contact">Contact</th>
<th class="job_from">From</th>
<th class="job_to">To</th>
<th class="job_driver nowrap">Driver</th>
<th class="job_income">Income (£)</th>
<th class="job_payment">Payment (£)</th>
<th>Update</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<!--Fetch from Database-->
<!--Connect To Database-->
<?php
$host_name = 'xxx';
$database = 'xxx';
$user_name = 'xxx';
$password = 'xxx';
$conn = mysqli_connect($host_name, $user_name, $password, $database);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT *,AS markup
FROM `table`
GROUP BY id";
$query = mysqli_query($conn, $sql);
if (mysqli_num_rows($query) > 0) {
// output data of each row
while($result = mysqli_fetch_assoc($query)) {
echo "<tr>
<td class='job_id'>".$result['id']."</td>
<td class='job_date'>".$result['adddate']."</td>
<td class='job_company'>".$result['customer']."</td>
<td class='job_contact'>".$result['addcontact']."</td>
<td class='nowrap job_from'>".$result['addfrom']."</td>
<td class='nowrap job_to'>".$result['addto']."</td>
<td class='nowrap job_driver'>".$result['adddriver']."</td>
<td class='currency job_income'>".$result['addincome']."</td>
<td class='currency job_payment'>".$result['addpayment']."</td>
<td><button type='button' name='update' id=".$result['id']." class='btn btn-warning btn-xs update updatebtn'>Update</button></td>
<td><button type='button' name='delete' id=".$result['id']." class='btn btn-danger btn-xs delete deletebtn'>Delete</button></td>
</tr>";
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>
</tbody>
</table>
</div>
<div id="contactForm3">
<h1>Edit Job</h1>
<form id="dataForm" name="dataform" method="POST" action="/">
/**** FORM DATA ****/
</form>
</div>
JS to open form:
$(function() {
// contact form animations
$('.update').click(function() {
$('#contactForm3').fadeToggle();
})
$(document).mouseup(function (e) {
var container = $("#contactForm3");
if (!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.fadeOut();
}
});
});
I have added the update button using <td><button type='button' name='update' id=".$result['id']." class='btn btn-warning btn-xs update updatebtn'>Update</button></td> I have given the id=".$result['id']." hoping that I can use this to populate the form from the ID
I am assuming that I will need to connect to the database table, something like:
<form>
<?php
//Connect to Database ... //
$sql = SELECT * FROM `table`
WHERE ID = ???
$query = mysqli_query($conn, $sql);
if (mysqli_num_rows($query) > 0) {
// output data of each row
while($result = mysqli_fetch_assoc($query)) {
echo "<span>
<label> label1 </label>
<input value = ".$result['column'].">
</span>";
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>
Im hoping that this is correct and someone can help me do this?
Actually you can acheive this using javascript/jquery, get row element from table displayed, from which you can get every columns/inputs value like as below:
$('.updatebtn').on('click', function(e) {
e.preventDefault();
var row = $(this).closest('tr'); //get table row from displayed table.
var form = $('#contactForm3').fimd('form'); //form to be populate.
//make sure your form input field with same name as the column name.
//now create form_data object with key as same name as column/input name .
var form_data = { 'id' : row.find('.job_id').value(),
'adddate' : row.find('.job_date').value(),
.....
'addpayment' : row.find('.job_payment').value()
}
//Apply loop to populate values in form.
$.each(form_data, function(key, value){
form.find('input[name="'+ key +'"]').val(value);
});
});
Then on form submit update database record/row using PHP (hope you know that well, if not let me know I will update my code).

SQL generated table in PHP, insert row into SQL only if user inputs correct ID

I have generated a table from a query and at the end of each row in the table there is a 'book' button. Once this button is selected, a modal asking the user to enter their ID is shown. Once the user enters their ID, a button is clicked and the ID is checked against the database.
What I would like to do is when the button is clicked within the modal have the selected row data and the members ID inserted into the database table. I'm getting confused on how I can get the selected row data after the modal is shown.
An image of php table:
Code for index.php
<table class="table table-bordered">
<tr>
<th width="10%">Class</th>
<th width="35%">Date</th>
<th width="40%">Time</th>
<th width="10%">Location</th>
<th width="5%">Book</th>
</tr>
<?php
while ($row = mysqli_fetch_array($sql)){
$classdescription = $row["class_description"];
$date = $row["date"];
$start = $row["startTime"];
$area = $row["area_description"];
?>
<tr>
<td><?php echo $classdescription?></td>
<td><?php echo $date?></td>
<td><?php echo $start?></td>
<td><?php echo $area?></td>
<td><input type="button" data-toggle="modal" data-target="#myModal" value="Book" name="book"/>
</td>'
</tr>
<?php
}
?>
</table>
</div>
</div>
<!-- Book Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Book Modal content-->
<form id = "bookingform" action="login.php" method="post">
Username: <input type="username" id="username" placeholder="username"></br>
<button id="book">Book</button>
</form>
code for login.php
<?php
$user = $_POST['user'];
require "connectivity.php";
$date = date("Y-m-d");
$query = "SELECT member_forename FROM member WHERE name='$user'";
$result = mysqli_query($con, $query);
if(mysqli_num_rows($result) == 1) {
$row = mysqli_fetch_assoc($result);
}
elseif (mysqli_num_rows($result) == 0) {
echo "Username not recogised";
}
$sql = "INSERT INTO booking (booking_id, booking_date, customer_ID, bschedule_date, bschedule_class_id) VALUES ('15', '$date', '3', '2017-12-32')";
if(mysqli_query($con, $sql)) {
echo "booking made";
}
?>
login.js
$(document).ready(function(){
$("#login_btn").click(function(){
var user = $("#username").val();
var data = "user=" + user;
$.ajax({
method: "post",
url: "login.php?",
data: data,
success: function(data){
$("#login_error").html(data);
}
});
});
This example is based on an example made on the site https://www.w3schools.com
I use PG_QUERYS but you can switch to MYSQL. The rest is what you want. Any doubt is just ask.
getuser.php
<!DOCTYPE html>
<html>
<head>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
padding: 5px;
}
th {text-align: left;}
</style>
</head>
<body>
<?php
$q = intval($_GET['q']);
$dbconn = pg_connect('localhost','peter','abc123','my_db');
if (!$con) {
die('Could not connect');
}
$query = "SELECT * FROM user WHERE id = $1";
$result = pg_prepare($dbconn, "my_query", $query);
$data = array($q);
$result = pg_execute($dbconn, "my_query", $data);
echo "<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>";
while($row = pg_fetch_row($result)) {
echo "<tr>";
echo "<td>" . $row[0] . "</td>";
echo "<td>" . $row[1] . "</td>";
echo "<td>" . $row[2] . "</td>";
echo "<td>" . $row[3] . "</td>";
echo "<td>" . $row[4] . "</td>";
echo "</tr>";
}
echo "</table>";
pg_close($dbconn);
?>
</body>
</html>
The Html
<html>
<head>
<script>
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();
}
}
</script>
</head>
<body>
<form>
<select name="users" onchange="showUser(this.value)">
<option value="">Select a person:</option>
<option value="1">Peter Griffin</option>
<option value="2">Lois Griffin</option>
<option value="3">Joseph Swanson</option>
<option value="4">Glenn Quagmire</option>
</select>
</form>
<br>
<div id="txtHint"><b>Person info will be listed here...</b></div>
</body>
</html>
This is a simple example, for you to understand the basics. If you want more help start programming, and if you have any difficulties ask the community.
In the example above, when a user selects a person in the dropdown list above, a function called "showUser()" is executed.
The function is triggered by the onchange event.
Code explanation:
First, check if person is selected. If no person is selected (str == ""), clear the content of txtHint and exit the function. If a person is selected, do the following:
1) Create an XMLHttpRequest object
2) Create the function to be executed when the server response is ready
3) Send the request off to a file on the server
Notice that a parameter (q) is added to the URL (with the content of the dropdown list)
The page on the server called by the JavaScript above is a PHP file called "getuser.php".
The source code in "getuser.php" runs a preaper execute on a PostgreSQL database, and returns the result in an HTML table.
Explanation: When the query is sent from the JavaScript to the PHP file, the following happens:
1) PHP opens a connection to a PostgreSQL server
2) The correct person is found
3) An HTML table is created, filled with data, and sent back to the "txtHint" placeholder.
What you want is to have the ID of the selected row in the modal, so that you can include it in the form and submit it to the login script. As I see it there are several approaches how you can achieve that.
One is to dynamically generate an individual modal for each row that includes its ID. Here you would move the modal code into the while loop and create a new modal for each row with an individual ID etc. The row ID should be included as hidden input in the form.
Another solution would be to use java script to keep track of which row has been selected. For that you need to
a) call a js function for each "book" button in the table that sets the row ID on a global JS var.
b) do the form submit with Java script and ensure the row ID is set first in the same script

How to update specific row from a dropdown list?

I want to update the table after after the option from drop down list is selected. However, when I click approve button, the car plate is not updated in the database. Can someone help me? Thanks.
<?php
mysql_connect("l","t","")or die(mysql_error()); // connect to server
mysql_select_db("car")or die("Cannot connect to database") ;
$query=mysql_query("Select * from list "); //SQL Query
echo "<table><tr>
<th>Name</th>
<th>Destination</th>
<th>Time</th>
<th>Date</th>
<th>Car Requested</th>
<th>Purpose</th>
<th>Car Approve</th>
<th>Approve</th>
<th>Reject</th>
</tr>";
while($row=mysql_fetch_array($query))
{
if($row['status'] =='Pending'){
echo"<tr>";
echo'<td align="center">'.$row['employee']."</td>";
echo'<td align="center">'.$row['destination']."</td>";
echo'<td align="center">'.$row['time']."</td>";
echo'<td align="center">'.$row['date']."</td>";
echo'<td align="center">'.$row['car']."</td>";
echo'<td align="center">'.$row['message']."</td>";
echo'
<form action="approve.php" method="GET">
<td align="center">
<select name="car_plate">
<option>--Select Car--</option>
<option>WBN 3041</option>
<option>WWW 4545</option>
<option>BBB 1111</option>
<option>CCC 2222</option>
<option>DDD 3333</option>
</select>
</td>
</form>
';
echo'<td align="center">Approve </td>';
echo'<td align="center">Reject </td>';
echo"<tr>";
}
}
echo"</table>";
?>
<script>
function fapprove(id)
{
var r=confirm("Are you sure you want to APPROVE this record?");
if(r==true)
{
window.location.assign("approve.php?id=" + id);
alert('APRROVED! =)');
}
}
</script>
approve.php
if($_SERVER['REQUEST_METHOD'] == "GET")
{
mysql_connect("l", "r","") or die(mysql_error()); //Connect to server
mysql_select_db("car") or die("Cannot connect to database"); //Connect to database
$id = $_GET['id'];
$car_plate = $_GET['car_plate'];
mysql_query("UPDATE list SET status='Approved' WHERE id='$id'");
mysql_query("UPDATE list SET car_plate='$car_plate' WHERE id='$id'");
You didnt pass the carplate number in your javascript function. Use below code
function fapprove(id)
{
var r=confirm("Are you sure you want to APPROVE this record?");
if(r==true)
{
var carPlate = $("#car_plate").val();
window.location.assign("approve.php?id="+id+"&car_plate="+carPlate);
alert('APRROVED! =)');
}
}
add id to the select dropdown as <select id="car_plate" name="">
Hope it will work for you. If you need any help I'm ready to guide you...

Generate dropdown lists which will send the selectted item back to server

This code allows somebody to pick a class from a drop down menu, in which I convert numbers to alphabet letters. Now I want to send the selected value back to the server:
<table id="example" class="display table" style="width: 100%; cellspacing: 0;">
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Hours</th>
<th>Class</th>
<th>Add</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Code</th>
<th>Name</th>
<th>Hours</th>
<th>Class</th>
<th>Add</th>
</tr>
</tfoot>
<tbody>
<?php
$query = "SELECT * FROM class";
$result = mysqli_query($connection,$query) or die ("Couldn’t execute query.");
while($row = mysqli_fetch_assoc($result))
{
echo "<tr>
<td>$row[code]</td>
<td>$row[name]</td>
<td>$row[hours]</td>";
$query1 = "SELECT total FROM classtot where code='$row[code]'";
$result1 = mysqli_query($connection,$query1);
while ($row=mysqli_fetch_assoc($result1))
{
$a=$row['total'];
}
$alphabet = range('A','Z');
$i = 1;
echo "
<td><select id='selectError' data-rel='chosen' name='class'>";
while ($i<=$a)
{
$kls=$alphabet[$i-1];
echo "<option value=$kls> $kls </option>";
$i=$i+1;
}
echo "</select></td>
<td>
<a class='btn btn-primary btn-addon m-b-sm btn-xs' href='home_member.php?page=add&id=$row[code]'>
<i class='fa fa-plus'></i> Add</a>
</td>
</tr>";
}
?>
</tbody>
</table>
How can I pass the slected value from the drop down menu 'class' to the server? I can pass the code, but don't know how to pass the selected class.
To add the chosen class to the URL, you will need to build the URL in JavaScript, because PHP does not know beforehand what the user will choose. Here is your code (only the part that goes through the SQL. In comments I describe several improvements I made (unrelated to your question):
<?php
// Make your query return ALL you need. Avoid second query:
$query = "SELECT class.code, class.name, class.hours, classtot.total
FROM class
INNER JOIN classtot ON classtot.code = class.code";
$result = mysqli_query($connection,$query) or die ("Couldn’t execute query.");
// Keep track of row number, for use in generating unique id property values
$rowIndex = 0;
while($row = mysqli_fetch_assoc($result))
{
$rowIndex++;
echo "<tr>
<td>$row[code]</td>
<td>$row[name]</td>
<td>$row[hours]</td>";
// Just pick the total from the combined query:
$a = $row['total'];
$alphabet = range('A','Z');
// Change id for select: You cannot assign the same id to several elements
echo "
<td><select id='select$rowIndex' data-rel='chosen' name='class' >";
// Use a zero-based for loop instead of a while
for ($i = 0; $i < $a; $i++)
{
// Reference $i now, not $i-1:
$kls = $alphabet[$i];
echo "<option value='$kls'> $kls </option>";
}
// Instead of hard-coding the URL, call a JS function that will make the url
echo "</select></td>
<td>
<a class='btn btn-primary btn-addon m-b-sm btn-xs' href='#'
onclick='gotoClass($rowIndex, \"$row[code]\")'>
<i class='fa fa-plus'></i> Add</a>
</td>
</tr>";
}
?>
</tbody>
</table>
<script>
// The JS function that builds the URL and triggers the navigation to it
function gotoClass(rowIndex, classCode) {
var sel = document.getElementById('select' + rowIndex);
location.href = 'home_member.php?page=add&id=' + classCode
+ '&something=' + sel.value;
return false;
}
</script>
In the above code, you need to change "something" to the correct URL parameter you want to use to pass the selected "alphabet" value.
If you have another select in the table rows, like this:
<select id='select2$rowIndex' data-rel='chosen' name='code' >
then extend the above javascript function as follows:
function gotoClass(rowIndex, classCode) {
var sel = document.getElementById('select' + rowIndex);
var sel2 = document.getElementById('select2' + rowIndex);
location.href = 'home_member.php?page=add&id=' + classCode
+ '&something=' + sel.value
+ '&othervalue=' + sel2.value;
return false;
}

Check all / uncheck all Checkbox in looping statement

i have a problem with my program. Here's my snippet code.
Here's the Javascript/Jquery code.
<script language='javascript'>
///SELECTING CHECKBOXES////
$(function(){
// add multiple select / deselect functionality
$("#selectall").click(function () {
$('.case').attr('checked', this.checked);
});
// if all checkbox are selected, check the selectall checkbox
// and viceversa
$(".case").click(function(){
if($(".case").length == $(".case:checked").length) {
$("#selectall").attr("checked", "checked");
} else {
$("#selectall").removeAttr("checked");
}
});
});
</script>
And here's the code where i will integrate that javascript.
<h2>Quotation ID</h2>
<?php
$select_orders = mysql_query ("SELECT * FROM tblorder WHERE project_id = '$project_id' GROUP BY quotation_id") OR DIE (mysql_error());
while ($row2=mysql_fetch_array($select_orders)){
$quote_id = $row2['quotation_id'];
?>
<h3 class="expand"><?php echo $quote_id; ?></h3>
<div class="collapse">
<table align='center' border='1' class='display'>
<thead>
<th><input type='checkbox' onclick='checkall()' id='selectall'/></th>
<th>Product Type</th>
<th width='20px'>Product type code</th>
<th width='20px'>Quantity</th>
<th>Width</th>
<th>Height</th>
<th>Total Sub.</th>
</thead>
<tbody>
<?php
$tots_tots = 0;
$tots_subs = 0;
$select_orders2 = mysql_query ("SELECT * FROM tblorder WHERE project_id = '$project_id' AND quotation_id = '$quote_id'") OR DIE (mysql_error());
while ($row3=mysql_fetch_array($select_orders2)){
$idd = $row3['id'];
$project_id2 = $row3['project_id'];
$order_id = $row3['quotation_id'];
$prod_type = $row3['prod_type'];
$prod_type_code = $row3['prod_type_code'];
$qty = $row3['qty'];
$width = $row3['width'];
$height = $row3['height'];
$tot_sub = $row3['total_subs'];
$tots_subs += $tot_sub;
echo "<tr bgcolor='".$colors[$c++ % 2]."' align='center'>";
echo "<td>
<input type='hidden' name='project_name' value='$project_name'>
<input type='checkbox' name='check_ptc[]' value='$prod_type_code' style='display:none;' checked>
<input type='checkbox' class='case' name='checkbox[]' value='".$idd."'></td>";
echo "
<input type='hidden' name='project_id[]' value='$project_id2'>
</td>";
echo "<td>".$prod_type."
<input type='hidden' name='quotation_id[]' value='$order_id'>
<input type='hidden' name='prod_type[]' value='$prod_type'>
</td>";
echo "<td>".$prod_type_code."
<input type='hidden' name='prod_type_code[]' value='$prod_type_code'>
</td>";
echo "<td>".$qty."</td>";
echo "<td>".$width."</td>";
echo "<td>".$height."</td>";
echo "<td>".$tot_sub."</td>";
echo "</tr>";
}
echo "<tr>";
echo "<td></td><td></td><td></td><td></td><td></td>
<td>
<strong><b>Total:</b></strong>";
echo "</td>";
echo "<td>
<font color='#900'><u><b>$tots_subs</b></u></font>
</td>";
echo "</tr>";
?>
</tbody>
</table>
</div>
<?php
}
?>
Since the table is in the loop. the problem is when the first table appear. and click the first header checkbox it will check all the checkbox in other table. which i dont want to happen. the one i am looking for is if there is a way i can also iterate the ID of the checkbox and its class. or there's any other way to do what i want to happen.
As you can see. those 3 tables have there own checkbox header where i want to be the check all inside there tables. what would be your smart idea how can i do that.
Thanks in advance..
You can do it like this.
$('.allcb').on('click', function(){
var childClass = $(this).attr('data-child');
$('.'+childClass+'').prop('checked', this.checked);
});
FIDDLE
UPDATE
Just apply the class allcb to the main check-boxes and to the child check-boxes apply the class named as chk. This should fit your needs. Here is the updated
FIDDLE
use .prop
$(function () {
var $cases = $('.case');
// add multiple select / deselect functionality
var $all = $("#selectall").click(function () {
$$cases.prop('checked', this.checked);
});
// if all checkbox are selected, check the selectall checkbox
// and viceversa
$cases.click(function () {
$all.prop("checked", $cases.filter(":not(:checked)").length) != 0);
});
});
try this php code instead script
//check-all / uncheck-all checkbox.
<a onclick="$(this).parent().find(':checkbox').attr('checked', true);"><?php echo $text_select_all; ?></a>/<a onclick="$(this).parent().find(':checkbox').attr('checked', false);"><?php echo $text_unselect_all; ?></a>

Categories