I have a page where I would like to display the menu of a restaurant using different categories e.a. Soup, Starters etc. By default there is a text coming from the database table content. This content should be replaced with content from the table menu depending on what link was clicked. I have a div called content
<?php
$i_page_id = 3;
$qryContent = " SELECT title, content FROM content WHERE page_id = $i_page_id";
$category_id = filter_input(INPUT_GET, 'category_id', FILTER_SANITIZE_NUMBER_INT);
$qryMenu = " SELECT menu_item_id, menu_item, item_description FROM menu_items WHERE category_id = category_id";
if ( ){
while ($row = $result->fetch_assoc()) {
echo "";
}
}
?>
But I have no idea how to echo this?
So to resume When landing on the page, by default the content from the query qryContent should be displayed. When one of the links is clicked the content from the query qryMenu should display.
Ok I got it using two files instead of one. So by default I load the text content for this page and when I click one of the links I load the menu.php with the right category_id
Hey donboe, I was just thinking about what you’re asking here (and the thread I helped you with yesterday)… are you actually generating the page with some default content? Relying on JS to load in your default content is not good practice, as your site is going to be broken for users who have JS disabled.