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 !

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.