View Full Version : Creating new set of dropdown menus on selection

Sep 19th, 2007, 05:47 AM
when an option is choosen from a dropdown list using select tag and based on which option was selected How to create a new set of dropdown menu just beside the original dropdown list.

Also from this new drop down that a user selects how can this value be passed to a php file in order to read which value was chosen from the newly creted drop down menu.

please advice

Sep 19th, 2007, 08:36 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<title>change 2nd select</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">
var varieties=[
["varieties","granny smith","golden delicious","jonathan"],

function Box2(idx) {
var f=document.myform;
for(i=0; i<varieties[idx].length; i++) {
f.box2.options[i]=new Option(varieties[idx][i], i);

<style type="text/css">


<form name="myform" method="post" action="http://www.mysite.com/mysite">
<select name="box1" onchange="Box2(this.selectedIndex)">
<option value="a">apple</option>
<option value="b">pear</option>
<option value="c">orange</option>
<select name="box2">


The form name/value pairs will be passed to the action URL in the form, in the normal way.