Chained Select menu

Sorry if this is posted elsewhere but i need a solution to this.

Well here it is.
I have 2 mysql tables

  1. category {catid*,name}
  2. subcategiry{id,catid*,name}

And 2 select box in my form. 1 for category and other for subcategory.

So when I choose an option from the category select menu. (Ex. Football)
I want the second select menu to show only the name of subcategories which fall under that category. (Ex. EPL, Primera Liga) etc.
I need it AJAX or simple javascript based. Hope u understand what i mean. I found few tutorials but could not convert to what i needed.