Jump to content


This topic is now archived and is closed to further replies.


Semi Amateur Requesting Help on MySQL / PHP

Recommended Posts

Ive been using Dreamweaver for a while now and have been building dynamic sites with PHP / MySQL which is great fun but recently i have hit a break wall on a latest development.

This is the current issue where im stuck ,

In one table which contains these details


On my .PHP Page I have created a Form, with a List Box and  created connection via MySQL to call all the Vehicles in this list.

Problem :

The List Box only contains either Manufacturer or Model Type not both at once, so I created another List Box in the Form so when the user selects the vehicle manufacturer it then filters the model dropdown box depending on the manufacturer.

I know there is way of using javascript to filter the options on selection but i wish to use the options stored in MySQL.

How do you program this Drop Down Box's that use MySQL Data, and how do you Filter them ? would you use $URL Variables or $FORM Variables or something different.

Any help would be great.

Share this post

Link to post
Share on other sites
ok I am not sure exactly what you meant. But here is what I would do if I wanted a dropdown box with the vehicle_manufacturer vehicle_model in it.

<select size="20" name="whatever">
$sql ="SELECT vechicle_manufacturer, vehicle_model FROM your_table";
$get_vechicles = mysql_query($sql);

if (!get_vechicles) {
    echo "Could not successfully run query ($sql) from DB: " . mysql_error();
if (mysql_num_rows($get_vechicles) == 0) {
    echo "There are no vechicles in the database";

while ($row = mysql_fetch_assoc($get_vechicles)) {
    echo '<option>' . $row['vechicle_model'] . ' ' . $row['vechicle_manufacturer'] .'</option>';

Hope this helps,

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.