Jump to content

second drop down depending on first drop down selection


stockychaser

Recommended Posts

Hi All,

 

I have 2 tables:

 

one

CarMake

- CarMakeID

- CarMakeDesc

 

two

CarModel

- CarModelID

- CarModelMake

- CarModelDesc

 

Depending on what the user selects in the first dropdown (carmake)

the possible selection in the second dropdown (model) needs to be limited to only the models from the selected carmake.

in the second table (Carmodel : the 'CarModelMake' = CarMakeID, to identify the make)

 

How do I limit the dropdown 'CarModel' based on the selected CarMake in the first dropdown.

 

link :    http://98.131.37.90/postCar.php

 

 

code :

-- -- --




		<label>
            <select name="carmake" id="CarMake" class="validate[required]" style="width: 200px;">

          <option value="">Select CAR MAKE...</option>

            <?php while($obj_queryCarMake = mysql_fetch_object($result_queryCarMake)) { ?>
                <option value="<?php echo $obj_queryCarMake->CarMakeID;?>"
                <?php if($obj_queryCarMake->CarMakeID == $CarAdCarMake) { echo 'selected="selected"'; } ?> >
                <?php echo $obj_queryCarMake->CarMakeDesc;?></option>
            <?php } ?>

        </select>
</label>

        <label>
	<select name="carmodel" id="CarModel" class="validate[required]" style="width: 200px;">

          <option value="">Select MODEL...</option>

            <?php while($obj_queryCarModel = mysql_fetch_object($result_queryCarModel)) { ?>
                <option value="<?php echo $obj_queryCarModel->CarModelID;?>"
                <?php if($obj_queryCarModel->CarmodelID == $CarAdCarModel) { echo 'selected="selected"'; } ?> >
                <?php echo $obj_queryCarModel->CarModelDesc;?></option>
            <?php } ?>

        </select>
</label>


 

I'm a novice.. and appreciates all the help !

Archived

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

×
×
  • Create New...

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.