This query will get you a list of unique values from the make
column. I suggest adding an index to that column on your table so that this query runs optimally.
SELECT DISTINCT make FROM car ORDER BY make
Given a specific make
value, this query will get you a list of the model
values associated with that make
value. Again, index the make
column so this runs optimally.
SELECT model FROM car WHERE make = ? ORDER BY model
In your PHP code, you'll need to use a prepared statement to specify the make value selected by the user as the value of the ?
marker in the above query.
If you specify which extension you're using to access your database (e.g. PDO, mysqli, etc.) I can provide more information on where to look in the PHP documentation regarding prepared statements.