Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
- <title>Survey Settings</title>
- <!-- Bootstrap -->
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <link href=" //maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
- <link href="https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css" rel="stylesheet">
- </head>
- <body>
- <br/>
- <hr/>
- <?php
- require_once("/dao/CategoryDAO.php");
- require_once("/dao/TopicDAO.php");
- $category = new CategoryDAO();
- $topic = new TopicDAO();
- $allCategories_arr = $category->getAllCategories();
- $allTopics_arr = $topic->getAllTopicTitles();
- ?>
- <?php
- $catid = 0;
- if(isset($_GET['catid']))
- $catid = $_GET['catid'];
- $catinfo = $category->getCategoryByCatID($catid);
- $subcategoryname = $_POST['subcategoryname'];
- if($catid != 0 ) {
- $allSubCategories_arr = $category->getSubCategoriesByID($catid);
- $category->AddSubcategory($catid,$catinfo); // adds the subcategory to the 'category' table
- ?>
- <div class="container">
- <div class="row">
- <?php echo $catinfo[0]['categoryname'] . "'s Subcategories" ; ?>
- </div>
- <div class="row">
- <form method="POST">
- <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th>Subcategory ID</th>
- <th>Subcategory Name</th>
- <th>Action</th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($allSubCategories_arr as $ar) {
- echo "<tr>";
- echo "<th>" . $ar['category_id'] . "</th>";
- echo "<th>" . $ar['categoryname'] . "</th>";
- echo "<th><a class='btn btn-default' href='viewtopicsundersubcategory.php?catid=".$catid."&subcatid=".$ar['category_id']."'>More Info<a/><a class='btn btn-info' href='EditSubCategory.php?category_id=".$ar['category_id']."'>Edit</th>";
- echo "</tr>";
- }
- ?>
- </tbody>
- </table>
- <div class="col-sm-2">
- <input type="text" name="subcategoryname" class="form-control input-sm" required />
- </div>
- <input type="submit" name="submit" value="Add Subcategory" class="btn btn-danger" />
- </div>
- </div>
- <?php
- }
- ?>
- <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
- <!-- Include all compiled plugins (below), or include individual files as needed -->
- <script src="js/bootstrap.min.js"></script>
- <script src="//code.jquery.com/jquery-1.12.4.js"></script>
- <script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
- <script src="https://cdn.datatables.net/1.10.13/js/dataTables.bootstrap.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- $('#example').DataTable();
- } );
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement