Вылажую весь код, только не менять значения
name и
value в
select и
option
<!doctype html>
<script>
window.onload = function () {//onload begin
var sel1 = document.getElementById('sel1');
var sel2 = document.getElementById('sel2');
var sel3 = document.getElementById('sel3');
var sel2copy = document.getElementById('sel2copy');
var childs = sel2.options;
var len = sel2.options.length;
var index;
var setPoints = function () {
index = sel1.selectedIndex;
sel2copy.innerHTML = '';
for (var i = 0; i < len; i++) {
if (parseInt(childs[i].value) == index) {
sel2copy.appendChild(childs[i].cloneNode(true));
}
}
}
setPoints();
sel1.onchange = function () {
setPoints();
sel3.selectedIndex = sel1.selectedIndex;
}
}//onload end
</script>
<form id="form2" name="form2" method="post" action="action.php" enctype="multipart/form-data">
<p><?PHP echo $language[225];?>
<select name="kategory_nazva" id="sel1">
<?PHP
for ($i=0; $i<=count($mass_kategory)-1; $i++)
{ echo "<option value=\"$mass_kategory[$i]\" ";
if ($mass_kategory[$i]==$kategory) {echo "selected";}
echo ">$mass_kategory[$i]</option>";
}
?>
</select>
<select name="subkategory_nazva" id="sel2" style="display: none">";
<?PHP
for ($i=0; $i<=count($mass_subkategory)-1; $i++)
{ echo "<option value=\"$mass_subkategory[$i]\" ";
if ($mass_subkategory[$i]==$subkategory) {echo "selected";}
echo ">$mass_subkategory[$i]</option>";
}
?>
</select>
<select name="subkategory_nazva" id="sel2copy">";
</select>
<p>
<?PHP echo $language[226];?>
<select name="new_kategory_nazva" id="sel3">
<?PHP
for ($i=0; $i<=count($mass_kategory)-1; $i++)
{ echo "<option value=\"$mass_kategory[$i]\" ";
if ($mass_kategory[$i]==$kategory) {echo "selected";}
echo ">$mass_kategory[$i]</option>";
}
?>
</select>
</form>