Exemplo n.º 1
0
		</tr>
		<tr>
			<td></td>
			<td id="submit"><input type="submit" name="Add" value="Add" ></td>
		</tr>
	</table>

</form>
<br/>
<br/>
<table class="table table-bordered table-hover table-striped table-responsive">
<tr><th colspan="3"><h2>All categories</h2></th></tr>

<?php 
$categ = new category();
$c = $categ->category();
foreach ($c as $key => $value) {
    $name = $value['name'];
    ?>
	<tr>
			<td><?php 
    echo $name;
    ?>
</td>
			<td><a href="editcategory.php?id=<?php 
    echo $value['tid'];
    ?>
">edit</a></td>
			<td><a href="removecategory.php?id=<?php 
    echo $value['tid'];
    ?>
Exemplo n.º 2
0
<?php

include 'categoryclass.php';
include 'subcategoryclass.php';
$cat = new category();
$c = $cat->category();
if (isset($_POST['Add'])) {
    if (!empty(trim($_POST['subcatname']))) {
        $subcat = new subcategory();
        $Type_id = $_POST['catname'];
        $scatname = $_POST['subcatname'];
        $subcat->insert($scatname, $Type_id);
    }
}
include 'header1.php';
?>
<form action="addSubcategory.php" method="post">	
<div id="inside">
	<div class="container">
	<div class="row">
    <table class="table table-bordered table-hover table-striped table-responsive">
		<tr><th colspan="2"><h2>Add new subcategory</h2></th></tr>
		<tr>
			<th>category name</th>

			<td><select name="catname">
			<?php 
foreach ($c as $key => $value) {
    $cat_id = $value['tid'];
    $name = $value['name'];
    echo "<option value='{$cat_id}'>{$name}</option> ";