Browse Source

categories integration

master
n0m1s 10 years ago
parent
commit
e6aac0a71b
2 changed files with 16 additions and 2 deletions
  1. +13
    -0
      categories.js
  2. +3
    -2
      index.php

+ 13
- 0
categories.js View File

@ -0,0 +1,13 @@
var categories = document.getElementsByClassName("categorie-checkbox");
var form = document.getElementById("form-categories");
for(categorie in categories)
{
categorie.addEventListener('change', function() {
//TODO
'use strict';
alert('OK');
form.submit();
}, false);
}

+ 3
- 2
index.php View File

@ -43,7 +43,7 @@ else
</div> </div>
</a> </a>
<div id="container"> <div id="container">
<form method="post" action="./update-categories.php">
<form method="post" id="form-categories" action="./update-categories.php">
<?php <?php
for($tab = 0; $tab < 2; ++$tab) for($tab = 0; $tab < 2; ++$tab)
{ {
@ -64,7 +64,7 @@ else
$cat_id = $categories[$cat_it]['cat_id']; $cat_id = $categories[$cat_it]['cat_id'];
$cat_title = $categories[$cat_it]['cat_title']; $cat_title = $categories[$cat_it]['cat_title'];
?> ?>
<input type="checkbox" id="cat_<?php echo $cat_id; ?>" name="cat_<?php echo $cat_id; ?>" <?php if($_SESSION['categorieStatus'][$cat_id]) echo 'checked'; ?> />
<input class="categorie-checkbox" type="checkbox" id="cat_<?php echo $cat_id; ?>" name="cat_<?php echo $cat_id; ?>" <?php if($_SESSION['categorieStatus'][$cat_id]) echo 'checked'; ?> />
<label for="cat_<?php echo $cat_id; ?>"><span></span><?php echo $cat_title;?></label><br /> <label for="cat_<?php echo $cat_id; ?>"><span></span><?php echo $cat_title;?></label><br />
<?php <?php
} }
@ -145,5 +145,6 @@ else
<div> <div>
</div> </div>
<script src="hamburger.js"></script> <script src="hamburger.js"></script>
<script src="categories.js"></script>
</body> </body>
</html> </html>

Loading…
Cancel
Save