Results 1 to 2 of 2

Thread: Difficulty in Popup Drop Down Menu

  1. #1
    Join Date
    Apr 2009
    gr8 india

    Exclamation Difficulty in Popup Drop Down Menu

    Plz help .........Hi i m working on php . i m not using any database .

    In a php page in which, when user select a value from a drop down menu , then it should jump to a new popup drop down menu.

    for example. in a form when user select a country from a drop down menu , so a popup drop down menu appear with all the state of the selected country.

    i think u all got it my problem, plz help me out.
    i m not using any data base.

    so your ans sholud be in java script, or in php or in html.

    Thanking you,
    Last edited by Pandit_India; 05-02-2009 at 05:18 AM.

  2. #2
    Join Date
    Jun 2005
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html lang="en"> 
    <SCRIPT LANGUAGE="JavaScript"> 
    <!-- Begin
    servers = new Array(
    	new Array(
    		new Array("us_state1", "s1"),
    		new Array("us_state2", "s2"),
    		new Array("us_state3", "s3"),
    		new Array("us_state4", "s4")
    	new Array(
    		new Array("can_state1", "cs1"),
    		new Array("can_state2", "cs2"),
    		new Array("can_state3", "cs3"),
    		new Array("can_state4", "cs4")
    function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
    	var i, j;
    	var prompt;
    // empty existing items
    for (i = selectCtrl.options.length; i >= 0; i--) {
    	selectCtrl.options[i] = null; 
    prompt = (itemArray != null) ? goodPrompt : badPrompt;
    	if (prompt == null) {
    	j = 0;
    	} else {
    	selectCtrl.options[0] = new Option(prompt);
    	j = 1;
    	if (itemArray != null) {
    // add new items
    for (i = 0; i < itemArray.length; i++) {
    	selectCtrl.options[j] = new Option(itemArray[i][0]);
    		if (itemArray[i][1] != null) {
    			selectCtrl.options[j].value = itemArray[i][1]; 
    // select first item (prompt) for sub list
    selectCtrl.options[0].selected = true;
    //  End --> 
    		<form action="processing_page.php" method="post" enctype="multipart/form-data"> 
    			Field 1
    			<select style="width: 235px;" name="game" onchange="fillSelectFromArray(this.form.server, ((this.selectedIndex == -1) ? null : servers[this.selectedIndex-1]));"> 
    				<option value="-1">Select Country</option> 
    				<option value="1">USA</option> 
    				<option value="2">Canada</option> 
    			</select> <br /><br />
    			Field 2
    			<select name="server" style="width: 235px;"> 
    				<option value="">Select Game First</option> 
    			<br /><br /><input type="submit" value=" Add " /> 
    Last edited by kender; 05-02-2009 at 05:48 AM.
    Don't want a roundhouse kick to the head?
    http://chucknorris2012.com -- sign the petition!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center