File: fwphp/01mater/shop/admin/category/category_list.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/01mater/shop/admin/category/category_list.php  >  Download  
File: fwphp/01mater/shop/admin/category/category_list.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change: ver 7.0.1 mnu, msg, mkd FUNCTIONAL namespaces, CRUD PDO trait, pretty URL-s
Date: 2 months ago
Size: 1,568 bytes
 

Contents

Class file image Download
<?php include 'view/header.php'; ?>
<?php
include 'view/sidebar_admin.php'; ?>
<main>

    <h1>Category Manager</h1>
    <table id="category_table">
        <?php foreach ($categories as $category) : ?>
<tr>
            <form action="." method="post" >
            <td>
                 <input type="text" name="name"
                        value="<?php echo htmlspecialchars($category['categoryName']); ?>">
            </td>
            <td>
                <input type="hidden" name="action" value="update_category">
                <input type="hidden" name="category_id"
                       value="<?php echo $category['categoryID']; ?>">
                <input type="submit" value="Update">
            </td>
            </form>
            <td>
                <?php if ($category['productCount'] == 0) : ?>
<form action="." method="post" >
                    <input type="hidden" name="action" value="delete_category">
                    <input type="hidden" name="category_id"
                           value="<?php echo $category['categoryID']; ?>">
                    <input type="submit" value="Delete">
                </form>
                <?php endif; ?>
</td>
        </tr>
        <?php endforeach; ?>
</table>

    <h2>Add Category</h2>
    <form action="." method="post" id="add_category_form" >
        <input type="hidden" name="action" value="add_category">
        <input type="text" name="name">
        <input type="submit" value="Add">
    </form>

</main>
<?php include 'view/footer.php'; ?>

For more information send a message to info at phpclasses dot org.