How to create PHP pages by following an order?

  mysql, php, tree

I am working on building a Webstie for a restaurant and because clients will need to be able to order the items from the menu I’ve got to store everything on a MySQL database.

Now, everything is going to be organized visually in "cards"(you’ll see what i mean in the image below) and each card is made up by an image and the title. Since I’m using PHP to deal with the SQL Queries and connection, the only thing I need is that once a card has been clicked, a new page gets presented with the same style, the same js scripts that I have, in other words, everything the same to the main page but with the correct number and type of cards.

enter image description here

You might have noticed that there are cards that create new pages with other cards inside and there are other cards, usually the last ones at the tree(image 3) that only create the menu. I’ve built everything and it works but all the data was stored inside JSON files and I had to copy the div for each card and create HTML pages for every category manually.

Now, I have already put everything inside the MySQL Database, I am referring to each item’s data. So, what I need to do is simply create other html pages with different cards inside or create a menu(depending on the type of card). So, I understood that I need to create a tree, I thought about doing it in PHP in this way:

$tree = array("Drinks" => array(
    "Alcholic" => array("Beers", "Vodka", "Wines"),
    "Non-Alcholic" => array("Juices", "Something Else...")
  "Food" => array(

But, I don’t have any idea about how to go from here. I tried my best to explain my objective in a clear and precise way. If, for any reason you need more details I will edit the post without any problems. This is a serious job and I will be very greatful for any amount of help I can get. Thanks in advance and have a great day!

Source: Ask PHP