Jump to content

select field question


fife

Recommended Posts

Hi.  I have two select fields one called category and the other sub category.  Both are in the format.

<select name="category" value="
							<?php $qGetCat = "SELECT * FROM club_category" ;
							$rGetCat = mysql_query($qGetCat);
							while ($Cat = mysql_fetch_assoc($rGetCat))
							{
							?>" />
                                <option value="<?php echo $Cat['categorys'];?>"><?php echo $Cat['categorys']; ?></option>
                                <?php } ?>
                                </select>

<select name="sub_category" value="
							<?php $qGetSubCat = "SELECT * FROM sub_categorys" ;
							$rGetSubCat = mysql_query($qGetSubCat);
							while ($SubCat = mysql_fetch_assoc($rGetSubCat))
							{
							?>" />
                                <option value="<?php echo $SubCat['sub_categorys'];?>"><?php echo $SubCat['sub_categorys']; ?></option>
                                <?php } ?>
                                </select>

 

 

Now I want to make it so that when a particular category is chosen for example self defence.  The sub category when clicked shows all the self defence stuff.  If watersports was chosen sub category would show things like swimming.  What do I need to look up to do this? At the minute there is no link the way I have coded these to fields.

 

In the database its self there is a;

 

category table with categoryID and category_name

 

sub category table with sub_cat_name and categoryID

 

I think this will work but I have never done this so its making my head hurt just thinking about it.  Does anyone have any advice, tuts or scripts to do this? 

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/227635-select-field-question/
Share on other sites

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.