WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Javascript linked dropdowns
Categories : Java Script, HTML, Classes and Objects
bastien koert
Date : Feb 16th 2007
Grade : 3 of 5 (graded 3 times)
Viewed : 9483
File : No file for this code example.
Images : No Images for this code example.
Search : More code by bastien koert
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Linking drop downs is a frequent question. Here is a javascript based example.

<html>
<head>
<script language='javascript'>
/*
  This assumes that you can work out how to fill the first box with php.

  Then you create a series of js arrays, one index for each value of the parent box filled with
  all the possible values for the child box. The below example assumes that the option value and
  text are the same. You can use additional separators to split those elements if the value and text
  are different (1,Here;2,There;3,Somewhere Else)


*/

var box2 = new Array();
box2['x'] = ",1,2,3";
box2['y'] = ",4,5,6";
box2['z'] = ",7,8,9";

var box3 = new Array();
box3['1'] = ",q,r,s";
box3['2'] = ",t,u,v";


function loadOptions(sParentBox, sChildBox)
{
  //get the value of the selected option
  var sParentValue = document.getElementById(sParentBox).value;
alert(sParentValue);
  //load the appropriate event list to the option box
  var theSel  = document.getElementById(sChildBox);

  //clear previous options
  theSel.options.length = null;

  //handle if there is no value
  if (sParentValue == ''){alert("exiting"); return;}

  if (sParentBox == "box1") {
    oTargetArray = box2;
  }else if(sParentBox == "box2"){
    oTargetArray = box3;
  }

  //split the array values by the separator
  var arrList     = oTargetArray[sParentValue].split(",");

  //loop thru the array of options to add them to the dropdown
  for (x=0; x < arrList.length; x++)
  {
    var newOpt     = new Option(arrList[x], arrList[x]);//(theText,theValue);
    var selLength  = theSel.length;
    theSel.options[selLength] = newOpt;
  }//next
}//end func

</script>
</head>
<body>
<form>
<table>
  <tr>
    <td>Box 1</td>
    <td>
      <select name="box1" id="box1" onchange="loadOptions(this.name,'box2');">
          <option value=''></option>
          <option value='x'>x</option>
          <option value='y'>y</option>
          <option value='z'>z</option>
      </select>
    </td>
  </tr>
  <tr>
    <td>Box 2</td>
    <td>
      <select name="box2" id="box2" onchange="loadOptions(this.name,'box3');">
      </select>
    </td>
  </tr>
  <tr>
    <td>Box 1</td>
    <td>
      <select name="box3" id="box3">
      </select>
    </td>
  </tr>

</form>
</body>
</html>



complete simply working javascript password generator file. Use letter, vowels, consonants (uppercase and lowercase) arrays to create a really random and secure password. improved security using time functions to initialize random number generator.
Categories : Java Script, HTML, Security, Authentication, Strings
Check if Javascript is Enabled or Disabled - Works in all Browsers
Categories : Java Script, HTML, Web Browsers
Bookmarklets are simple tools that extend the surf and search capabilities of Netscape and Explorer web browsers.
Categories : Java Script, HTML, General
Mordern Peroidic Table - Science
Categories : Java Script, HTML, Charts and Graphs
Javascript Color Picker
Categories : Java Script, Colors, HTML
Table editable dynamic form with edit + selection (select / option) + checkbox.
Categories : Java Script, DHTML, User Interface, CSS, HTML
Unobtrusive javascript for maintaining scrollable layer state
Categories : DHTML, Java Script, HTML
Higly Customizable Javascript Calendar Script
Categories : Java Script, Calendar, Date Time, HTML, CSS
How to get the Focus (Cursor) into a Form-Element.
Categories : HTML, Java Script
Cool tool tip
Categories : Java Script, HTML, Web Design
Java Script Based Navigation
Categories : HTML, Java Script, Navigation
Show or Hide your Content using Javascript
Categories : Java Script, HTML, CSS, Beginner Guides
Conditional Check - a script that allows a user to submit a form only if the user check a checkbox.
Categories : HTML, Java Script, Form Processing, Beginner Guides
Enchancing dd/mm/yyyy forms with unobtrusive javascript
Categories : Java Script, HTML, User Interface, Date Time
showing Help (assistance) to the user while filling html forms.
Categories : HTML, Java Script, Form Processing