Jump to content

Recommended Posts

    Here is the code.The problem is that when i check the checkbox automatically unchecked and I am try to input the values of checkboxes to datable without submitting via button.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lumino - Tables</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/datepicker3.css" rel="stylesheet">
<link href="css/bootstrap-table.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">

<!--Icons-->
<script src="js/lumino.glyphs.js"></script>


<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->

</head>



<body>


<!--Header-->
<?php include 'includes/header.php';
include '../main_includes/connect_db.php';
include 'includes/functions.php';
?>
<!--end Header-->


<!-- .SIDEBAR -->
<?php include 'includes/sidebar.php'; ?>
<!--/.sidebar-->


<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
<div class="row">
<ol class="breadcrumb">
<li><a href="#"><svg class="glyph stroked home"><use xlink:href="#stroked-home"></use></svg></a></li>
<li class="active">Icons</li>
</ol>
</div><!--/.row-->

<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Tables</h1>
</div>
</div><!--/.row-->
</div>


<form action="" method="post">
<table class="table table-bordered table-hover" id="pinakas">
<thead>
<tr>
<th class="titlos"><input style="margin-left: 3px;" type="checkbox" name="checkboxAllBoxes" id="checkboxAllBoxes "></th>
<th class="titlos">POST_ID</th>
<th class="titlos">ΚΑΤΗΓΟΡΙΑ</th>
<th class="titlos">ΤΙΤΛΟΣ</th>
<th class="titlos">ΚΕΙΜΕΝΟ</th>
<th class="titlos">FILE</th>
<th class="titlos">ΕΚΔΟΤΗΣ</th>
<th class="titlos">ΗΜΕΡ.</th>
<th class="titlos">UPDATE</th>
<th class="titlos">DELETE</th>
</tr>
</thead>


<?php

global $connect;
$query="SELECT * FROM posts ORDER BY post_date DESC ";
$select_posts= mysqli_query($connect, $query);
while($row= mysqli_fetch_assoc($select_posts)) {
$post_id=$row['post_id'];
$post_cat_title=$row['post_cat_title'];
$post_title=$row['post_title'];
$post_keimeno= substr($row['post_keimeno'], 0, 60);
$post_publisher=$row['post_publisher'];
$post_image=$row['post_image'];
$post_date=$row['post_date'];
$post_check=$row['post_check'];




echo "<tr>";?>

<td><input type='checkbox' name="checkbox" id="<?php echo $post_id; ?>" value="txt" onchange="check(this);"></td>;

<?php
echo "<td class='keli'><strong>$post_id</td>";
echo "<td class='keli'>$post_cat_title</td>";
echo "<td class='keli'>$post_title</td>";
echo "<td class='keli'>$post_keimeno</td>";
echo "<td><img src='../images/$post_image' height='50' witdth='50'></td>";
echo "<td class='keli'>$post_publisher</td>";
echo "<td class='keli'>$post_date</td>";
?>
<td><a href="tables.php?source=tables&update=<?php echo $post_id; ?>">UPDATE</a></td>
<td><a href="tables.php?source=tables&delete=<?php echo $post_id; ?>">Delete</a></td>
</tr>
<?php
}

?>


</table>
</form>


<div class="button">
<!--<button class="koumpi" type="submit" name="submit">SUBMIT</button>-->
<button type="submit" name="delete"class="btn btn-primary">Delete</button>
<button type="submit" class="btn btn-primary" name="update" style="background-color: green;">UPDATE</button>
<button type="submit" class="btn btn-primary">Submit Button</button>

</div>

<!--/.row-->
<!--/.main-->

<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/chart.min.js"></script>
<script src="js/chart-data.js"></script>
<script src="js/easypiechart.js"></script>
<script src="js/easypiechart-data.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script src="js/bootstrap-table.js"></script>
<script>
function check(ch){
if(ch.checked){
window.location.href = "tables.php?source=tables&checkbox="+ch.id+"&value=checked";
//windows.location.replace("http://yahoo.com");

}
else{
window.location.href = "tables.php?source=tables&checkbox="+ch.id+"&value=unchecked";

}
}

</script>

<!--/.main-->


</body>

</html>




 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.