i wanna swap dropdown value on change event as if i select the value from '4' to '1' in dropdown then it will change the value of that drop down having value '1' my code is define as under,
<?php
$host="****"; // Host name
$username="***"; // Mysql username
$password="****"; // Mysql password
$db_name="****"; // Database name
$tbl_name="*****"; // Table name
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$arr = explode("?", $_SERVER['REQUEST_URI']);
$arr1=explode("&",$arr[1]);
$arr2=explode("=",$arr1[0]);
$sql="SELECT * FROM $tbl_name where idTemplates=$arr2[1]";
$result=mysql_query($sql);
$count=0;
//$templateName=mysql_result($result,$i,"TempName");
//$tempID=mysql_result($result,$i,"idTemplates");
$Section1=mysql_fetch_row($result);
for($j=6;$j<=15;$j++)
{
if($Section1[$j]!="")
{
$count++;
}
}
for($j=6;$j<=15;$j++)
{
if($Section1[$j]!="")
{
echo("<tr>");
echo("<td>");
echo("$Section1[$j] <input type='hidden' value='$Section1[$j]' name='Sections[]' />");
echo("</td>");
echo("<td>");
$counting=$j-5;
echo("<select id='Numbering".$counting."' onchange='OnChangeSelection(Numbering".$counting.".options[Numbering".$counting.".selectedIndex].value);'>");
for($k=1;$k<=$count;$k++)
{
if($k==($j-5))
{
echo("<option value='$k' selected='".$counting."'>$k</option>");
}
else
{
echo("<option value='$k'>$k</option>");
}
}
echo("</select>");
echo("</td>");
echo("</tr>");
}
}
?>
in the above code i am printing three column first section is section name and second column is section details and third is combo dropdown box having nuber value in it as shown in the fig,
and this is the js on change,
function OnChangeSelection(selection)
{
alert(selection);
}
how to alter it so that as we change the drop down value it would change the other drop down having same value ??
hopes for your suggestions thanks in advance