I am pretty new to this so just trying to figure something out. My overall goal is to create a drop down menu in my navbar that shows themes and when you click on an element it changes the color theme of the page. In my database I have 2 tables. One that lists the theme and an Id for the theme and another table that has the hex codes related to that theme.
Ordered as such:
themes table:
ID | Theme
colors table: (Theme ID and ID in themes table are the same)
ID | Theme ID | hex Code
I am trying to break this down into steps:
- retrieve theme names from SQL and make a new li in my ul for each row in the table
- When the li for a theme is clicked, retrieve hex codes for the theme colors from the colors table as php variables.
- (The stylesheet is a .php document with php variables used to assign colors to various css tags on the page). Use php variables from the previous step to change the variable values in this file ultimately changing the color scheme (theme) of the page.
If there is a smarter way to do this I would love to know about it.The trouble I am having right now is. I am new to PHP and I don't know how to do step 1. I think I can manage steps 2-3 but I can't find anything on how to add an li to a drop down list for each row retrieved.
<li>themes
<ul>
<!-- add theme names here -->
</ul>
</li>