views:

59

answers:

0

sir, i hav a list.from these list i want to select multiple values to another list and get these values using php.here is my code.

<script type="text/javascript">
function addOption_list()
{
 for(i=document.drop_list.Category.options.length-1;i>=0;i--) 
 {
  var Category=document.drop_list.Category;
  //document.write(Category);
  if(document.drop_list.Category[i].selected)
  {
   addOption(document.drop_list.SubCat, document.drop_list.Category[i].value, document.drop_list.Category[i].value);

  }
 }
}

function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}

function removeOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
 {
 if(selectbox.options[i].selected)
 selectbox.remove(i);
 }
}
</script>
<body>

<form name="drop_list" action="" method="post">
  <select name="Category" multiple="multiple" size="7">
    <option value="PHP" selected>PHP</option>
    <option value="ASP">ASP</option>
    <option value="JavaScript">JavaScript</option>
    <option value="HTML">HTML</option>
    <option value="Perl">Perl</option>
    <option value="MySQL">MySQL</option>
  </select>
 <input onclick="addOption_list()" ;="" value="Add" type="button">
  <select id="SubCat" name="SubCat" multiple="multiple" size="7"></select><input onclick="removeOptions(SubCat)" ;="" value="Remove" type="button">
</form>