Location: PHPKode > scripts > WH Board > wh_board/admin/categories.php
<?php require('management/admin_functions/session.php'); ?>
<?php require('management/admin_layout/header.php'); ?>

    <ul id="breadcrumbs">
        <li><a href="index.php"><?php echo $lang['main_navigation']; ?></a></li>
        <li><a href="categories.php" class="actual"><?php echo $lang['manage_categories']; ?></a></li>
    </ul>

    <div class="clear_blog"></div>

    <?php

    if($_SERVER['REQUEST_METHOD'] != 'POST') {

    echo '<form method="post" action="">
    <p><input type="text" name="cat_name" id="cat_name" class="textfields" size="40"> ' . $lang['name_of_category'] . '</p>
    <p>' . $lang['description_of_category'] . '</p>
    <textarea cols="45" rows="8" name="cat_description" id="cat_description" class="textareas"></textarea>
    <p><input type="submit" name"submit" id="submit" alt="' . $lang['create_category'] . '" value="' . $lang['create_category'] . '" class="buttons"></p>
    </form>';

    }else{

    $sql = "INSERT INTO
                categories(cat_name, cat_description)
    		VALUES('" . mysql_real_escape_string($_POST['cat_name']) . "',
    		    '" . mysql_real_escape_string($_POST['cat_description']) . "')";

    $result = mysql_query($sql) OR die(mysql_error());

    if(!$result) {

    echo '<p class="false">' . $lang['failed_category_create'] . '</p>';

        }else{

        echo '<p class="success">' . $lang['success_category_create'] . '!</p>';
        }
    }

    echo '<div class="clear_blog"></div>
    <h1>Kategorien</h1>';

    $query = "SELECT * FROM categories";
    $result = mysql_query($query) OR die(mysql_error());

    if($result) {

    echo '<table width="100%" class="tables">
    <tr>
    <td width="5%"><strong>ID</strong></td>
    <td width="25%"><strong>' . $lang['name_of_cat'] . '</strong></td>
    <td width="60%"><strong>' . $lang['blank_description'] . '</strong></td>
    <td width="10%" align="center"><strong>' . $lang['blank_delete'] . '</strong></td>
    </tr>';

    while($row = mysql_fetch_assoc($result)) {

        echo '<tr>
        <td width="5%">' . (int)$row['cat_id'] . '</td>
        <td width="25%">' . htmlentities($row['cat_name'], ENT_QUOTES) . '</td>
        <td width="60%">' . stripslashes($row['cat_description']) . '</td>
        <td width="10%" align="center"><a href="categories_delete.php?cat_id=' . (int)$row['cat_id'] . '"><img src="../style/images/admin/icons/delete.png" alt="' . $lang['blank_delete'] . '" title="' . $lang['blank_delete'] . '" border="0"></a></td>
        </tr>';
        }

    echo '</table>';

    }else{

    echo '<p class="false">' . $lang['no_categories'] . '</p>';
    }

    ?>

<?php require('management/admin_layout/footer.php'); ?>
Return current item: WH Board