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