Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

Filling html select with php/sql

$
0
0

I have the following Category Table in my SQL Database. Every Category has a supercategory, every supercategory can have multiple subcategories.

CREATE TABLE Kategorien (
ID INT UNSIGNED AUTO_INCREMENT,
Bezeichnung VARCHAR(255) NOT NULL DEFAULT 'Bezeichnung',
PRIMARY KEY(ID),
Kategorien_ID INT UNSIGNED,
Bilder_ID INT UNSIGNED,
CONSTRAINT kidk FOREIGN KEY (Kategorien_ID) REFERENCES Kategorien(ID)
);

I want to fill the html select like this with php. So that the supercategory is an optgroup and the corresponding subcategories as options in that optgroup.

Picture of html select Example

Image

How can i do this? What query should i send? How to fill the select with the data in php?

Image


Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>