Hi Bhavin -

You'll find a lot of information on google if you search for 
"Interdependent Dropdown" or "Interdependent Select"

There are a couple approaches to this:

1.) Oldschool Javascript Approach

    In this one, you use PHP to generate some Javascript to be included 
in your output page.
    You'll populate some javascript arrays with ALL of the various 
options to be included in your dropdown.

    Pros: Everyone and their mom has built one of these, and there are a 
ton of good examples and tutorials
    Cons: Not very friendly in terms of accessibility, heavy page downloads

2.) Hybrid Javascript/CSS Approach

    I found this approach on the Unobtrusive Javascript website and have 
been using it successfully in recent projects.
    They use a combination of "class" parameters (ie. <option 
class='parent_category'> ) and javascript.

    Pros: The markup is cleaner -- you're generating HTML instead of 
Javascript with your PHP, degrades more gracefully
    Cons: Heavy page download

3.) AJAX Approach

    Based on the value selected in the first dropdown, you would 
dynamically update the page via the Javascript DOM.
    You'd probably benefit from the use of an AJAX framework like 
Taconite (http://taconite.sourceforge.net/)

    Pros: Lightweight initial transfer if you've got a huge amount of 
options in your dropdowns.
    Cons: AJAX is HARD.  :)

I've posted more details about this particular issue a few times on this 
forum.
Search the forum archives (or google) for more information on the option 
that sounds most appropriate for your project.

-Jeromie


>Hello All PHP Experts,
>  This is Bhavin Shah, inneed of help from your end, I
>am designing a form, in which i am having two Drop
>down box, Value of Second Drop Down is dependent on
>first. For Example, if we sign in any mail A/C, we
>find Country and State. The Value of State is
>dependent on the Value of Country. If any One can
>provide me with the small help. 
>the Database
>Table[Country] : CountryId, CountryName;
>Table[State] : stateid, countryId, StateName;
>
>
>
>Thanks in Advance;
>Regards
>Bhavin
>
> New Document 
>
>Send instant messages to your online friends http://in.messenger.yahoo.com 
>
>
>
>
>
>The php_mysql group is dedicated to learn more about the PHP/MySQL web 
>database possibilities through group learning.  
>Yahoo! Groups Links
>
>
>
> 
>
>
>  
>



The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to