function categories_header()
{
    /*
    echo "<pre>";
    var_dump(process_categories($_GET['categories']));
    echo "</pre>";
    */
    global $cfgrow, $pixelpost_db_prefix;
    if ($_GET['x'] == "save" and isset($_POST['categories'])) {
        if (isset($_POST['categories'])) {
            $tags = process_categories($_POST['categories']);
            #echo "Pass #3 of 3<BR>\n";
            #	echo "EXECUTE MYSQL TAGS!!!";
            unset($_POST['category']);
            $categories = categories_array(false);
            $i = 0;
            while ($i < count($tags)) {
                $cat_id = array_search(strtolower($tags[$i]), $categories);
                if ($cat_id) {
                    $category[] = $cat_id;
                } elseif (CREATECAT == true) {
                    $query = "INSERT INTO " . $pixelpost_db_prefix . "categories(id,name) VALUES(NULL,'" . $tags[$i] . "')";
                    $result = mysql_query($query) || die("Error: " . mysql_error());
                    $cat_id = mysql_insert_id();
                    $category[] = $cat_id;
                }
                $i++;
            }
            // subsetude tags for categories
            $_POST['category'] = $category;
        }
    }
}
Exemple #2
0
        <p>Ціна:<br>
            <input type="text" name="price" value="<?php 
    echo $selected_book['price'];
    ?>
" /> грн.
        </p>
        <p>Додаткова інформація, крім анотації (зміст, передплата):<br>
            <input type="text" name="additional_info" value="<?php 
    echo htmlentities($selected_book['additional_info']);
    ?>
" />
        </p>
        <p>Категорія:<br>
            <select name="category">
                <?php 
    $categories = categories_array();
    foreach ($categories as $category) {
        if ($category === 'без категорії') {
            echo "<option value=\"\"";
        } else {
            echo "<option value=\"{$category}\"";
        }
        if ($category === $selected_book['category']) {
            echo " selected";
        }
        echo ">{$category}</option>";
    }
    ?>
            </select>
        </p>
        <input type="hidden" name="id" value="<?php 
<body>

<table class="price_list_print_table htable">
    <tr>
        <th>№ п/п</th>
        <th>Назва видання і автор</th>
        <th>Рік видання</th>
        <th>Кіл-ть стор.</th>
        <th>Ціна, грн.</th>
    </tr>
    <?php 
$count = 1;
foreach ($list_of_books as $book) {
    // If count is less than the number of categories_array elements echo a category name
    if ($count < count(categories_array())) {
        if ($book['category'] === categories_array()[$count]) {
            echo "<tr><td colspan='6'>";
            echo "<h2>" . $book['category'] . "</h2>";
            echo "</td></tr>";
            $count++;
        }
    }
    ?>
    <tr>
        <td><?php 
    echo $book['position'];
    ?>
</td>
        <td class="title_price_list"><strong><?php 
    echo $book['title_price_list'];
    ?>