How will I make stay and hold the value of the checked radio button when I go to the next page? should I use session method? Here's my code:
include('includes/dbconn2.php');
// PAGINATION
if(isset($_GET['pageno'])){
$pageno = $_GET['pageno'];
}else{
$pageno =1;
}
$no_of_records_per_page = 5;
$offset = ($pageno-1) * $no_of_records_per_page;
// get no of total no. pages
$total_pages_sql = "SELECT COUNT(item_id) AS total FROM items WHERE cat_id = 4";
$result = $conn->query($total_pages_sql);
$total_rows = $result->fetch_assoc();
// calculate total pages with results
$total_pages = ceil($total_rows['total'] / $no_of_records_per_page);
// sql query for pagination
$get_items = "SELECT item_id, item_name FROM items WHERE cat_id = 4 LIMIT $offset, $no_of_records_per_page";
if($results=$conn->query($get_items)){
while($row=$results->fetch_assoc()){
$app_id=$row['item_id'];
$app_name=$row['item_name'];
?>
<tr>
<td><?php echo $app_name; ?> </td>
<td> <label class="container"><input type="radio" name="<?php echo $app_name?>-<?php echo $app_id; ?>" value="P0"><span class="checkmark"></span></label> </td>
<td> <label class="container"><input type="radio" name="<?php echo $app_name?>-<?php echo $app_id; ?>" value="P1"> <span class="checkmark"></span></label></td>
<td> <label class="container"><input type="radio" name="<?php echo $app_name?>-<?php echo $app_id; ?>" value="P2"> <span class="checkmark"></span></label></td>
</tr>
<?php
}
$results->close();
}