how to make two select box one for states of india and second for districts of individual state when select one state in second select box display district only this state for example if i select uttar pradesh in first select box then another select box display district only uttar pradesh plz help me...........
<script> var States = new Array(); States[1]=["1 SubState 1","1 SubState 2", "1 SubState 3"]; States[2]=["2 SubState 1","2 SubState 2"]; States[3]=["3 SubState 1","3 SubState 2", "3 SubState 3", "3 SubState 4"]; function selectState(stateId) { subSelectOptions = ''; selectedState = States[stateId]; for (x in selectedState) { subSelectOptions += '<option value="'+selectedState[x]+'">'+selectedState[x]+'</option>'; } document.getElementById('substate').innerHTML = subSelectOptions; } </script> State: <select name="state" id="state" onchange="selectState(this.value);"> <option value="1">State 1</option> <option value="2">State 2</option> <option value="3">State 3</option> </select><br /><br /> Sub State: <select name="substate" id="substate"> <option value="0">Select State Before</option> </select> HTML:
thanks kokulusilgi, nice and it's working but i am fetch state table and district table from mysql database because its very large database near about 35 state in state table and 965 district in district table then how can make select box sorry because in my first query i do not mention this condition once again thanks but plz tell me for this type.............