?> </h2> <form action="edit_category.php?category=<?php echo urlencode($current_category["id"]); ?> " method="post"> <p>Book name: <input type="text" name="category_name" value="<?php echo htmlentities($current_category["category_name"]); ?> " /> </p> <p>Position: <select name="position"> <?php $category_set = find_all_category(false); $category_count = mysqli_num_rows($category_set); for ($count = 1; $count <= $category_count; $count++) { echo "<option value=\"{$count}\""; if ($current_category["position"] == $count) { echo " selected"; } echo ">{$count}</option>"; } ?> </select> </p> <p>Visible: <input type="radio" name="visible" value="0" <?php if ($current_category["visible"] == 0) { echo "checked";
/** * This navigation will shown to all website's visitors * * @param category_array showing the list of all categories list menu * @param book_array showing the list of all books list menu * @return output */ function public_navigation($category_array, $book_array) { $output = "<ul class=\"category\">"; $category_set = find_all_category(); while ($category = mysqli_fetch_assoc($category_set)) { $output .= "<li"; if ($category_array && $category["id"] == $category_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"index.php?category="; $output .= urlencode($category["id"]); $output .= "\">"; $output .= htmlentities($category["category_name"]); $output .= "</a>"; if ($category_array["id"] == $category["id"] || $book_array["category_id"] == $category["id"]) { $book_set = find_books_for_category($category["id"]); $output .= "<ul class=\"books\">"; while ($book = mysqli_fetch_assoc($book_set)) { $output .= "<li"; if ($book_array && $book["id"] == $book_array["id"]) { $output .= " class=\"selected\""; } $output .= ">"; $output .= "<a href=\"index.php?book="; $output .= urlencode($book["id"]); $output .= "\">"; $output .= htmlentities($book["category_name"]); $output .= "</a></li>"; } $output .= "</ul>"; mysqli_free_result($book_set); } $output .= "</li>"; // end of the subject li } mysqli_free_result($category_set); $output .= "</ul>"; return $output; }