noureen Posted October 2, 2007 Share Posted October 2, 2007 Hello, i am stuck with the problem. I want to add names of the states in drop down menu but i want them to be selected under each category like if user selects USA then its all states shd be shown from database. can any one help me in this regard. THx Quote Link to comment https://forums.phpfreaks.com/topic/71539-sorting-the-values-in-drop-down-menu/ Share on other sites More sharing options...
MadTechie Posted October 2, 2007 Share Posted October 2, 2007 this may help http://www.phpfreaks.com/forums/index.php/topic,155984.0.html Quote Link to comment https://forums.phpfreaks.com/topic/71539-sorting-the-values-in-drop-down-menu/#findComment-360194 Share on other sites More sharing options...
noureen Posted October 2, 2007 Author Share Posted October 2, 2007 thx fo rthe link i hav seen that but not able to understand Function ajax can u plz exaplain that. Thx Quote Link to comment https://forums.phpfreaks.com/topic/71539-sorting-the-values-in-drop-down-menu/#findComment-360197 Share on other sites More sharing options...
MadTechie Posted October 2, 2007 Share Posted October 2, 2007 OK example <select name="list1" onchange="ajaxFunction('LBox2', this.value);"> <option value='1'>Red</option> <option value='5'>Green</option> <option value='10'>Blue</option> </select> Now when the Item from list1 is selected the value LBox2 and the selected value is passed to the a PHP script, in the example it passes to itself, now that part echos some data back, NOW whatever is echoed is printed in the object with the ID LBox2.. which in the example is <select name="list2" id="LBox2"> <!-- OK the ID of this list box is LBox2 as refered to above --> </select> so "<!-- OK the ID of this list box is LBox2 as refered to above -->" is replaced make sense ? Quote Link to comment https://forums.phpfreaks.com/topic/71539-sorting-the-values-in-drop-down-menu/#findComment-360206 Share on other sites More sharing options...
noureen Posted October 2, 2007 Author Share Posted October 2, 2007 thx will this ajax fuction will work when i use static valuse in my drop down list not from database? Quote Link to comment https://forums.phpfreaks.com/topic/71539-sorting-the-values-in-drop-down-menu/#findComment-360229 Share on other sites More sharing options...
MadTechie Posted October 2, 2007 Share Posted October 2, 2007 yes, as on the example i used some code to Emulate a database //Emulate the database $DB[1][] = "NewItem1 - 1"; $DB[1][] = "NewItem1 - 2"; $DB[2][] = "NewItem2 - 1"; $DB[2][] = "NewItem2 - 2"; Quote Link to comment https://forums.phpfreaks.com/topic/71539-sorting-the-values-in-drop-down-menu/#findComment-360373 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.