0
我有一個嵌套的PHP數組。我已經有第一個選擇填充。我希望第二個選擇填充基於選定選項的php數組的值,這是我php數組中的關鍵。我已經檢查過其他帖子,而且他們看起來太複雜以至於我無法理解和/或實施。我想你會明白,一旦你看到它:填充選擇基於另一個選擇php陣列
<?php
$books = array(
"លោកុប្បត្តិ"=> range(1,50),
"និក្ខមនំ"=> range(1,40),
"លេវីវិន័យ"=> range(1,27),
"ជនគណនា"=> range(1,36),
"ចោទិយកថា"=> range(1,34),
"យ៉ូស្វេ"=> range(1,24),
"ពូកចៅហ្វាយ"=> range(1,21),
"នាងរស់"=> range(1,4),
"សាំយូអែល ទី១"=> range(1,31),
"សាំយូអែល ទី២"=> range(1,24),
"ពង្សាវតារក្សត្រ ទី១"=> range(1,22),
"ពង្សាវតារក្សត្រ ទី២"=> range(1,25),
"របាក្សត្រ ទី១"=> range(1,29),
"របាក្សត្រ ទី២"=> range(1,36),
"អែសរ៉ា"=> range(1,10),
"នេហេមា"=> range(1,13),
"នាងអេសធើរ"=> range(1,10),
"យ៉ូប"=> range(1,42),
"ទំនុកដំកើង"=> range(1,150),
"សុភាសិត"=> range(1,31),
"សាស្ដា"=> range(1,12),
"បទចំរៀងសាឡូម៉ូន"=> range(1,8),
"អេសាយ"=> range(1,66),
"យេរេមា"=> range(1,52),
"បរិទេវ"=> range(1,5),
"អេសេគាល"=> range(1,48),
"ដានីយ៉ែល"=> range(1,12),
"ហូសេ"=> range(1,14),
"យ៉ូអែល"=> range(1,4),
"អេម៉ុស"=> range(1,9),
"អូបាឌា"=> range(1,1),
"យ៉ូណាស"=> range(1,4),
"មីកា"=> range(1,7),
"ណាហ៊ុម"=> range(1,3),
"ហាបាគុក"=> range(1,3),
"សេផានា"=> range(1,3),
"ហាកាយ"=> range(1,2),
"សាការី"=> range(1,14),
"ម៉ាឡាគី"=> range(1,3),
"ម៉ាថាយ"=> range(1,28),
"ម៉ាកុស"=> range(1,16),
"លូកា"=> range(1,24),
"យ៉ូហាន"=> range(1,21),
"កិច្ចការ"=> range(1,28),
"រ៉ូម"=> range(1,16),
"កូរិនថូស ទី១"=> range(1,16),
"កូរិនថូស ទី២"=> range(1,13),
"កាឡាទី"=> range(1,6),
"អេភេសូរ"=> range(1,6),
"ភីលីព"=> range(1,4),
"កូល៉ុស"=> range(1,4),
"ថែស្សាឡូនីច ទី១"=> range(1,5),
"ថែស្សាឡូនីច ទី២"=> range(1,3),
"ធីម៉ូថេ ទី១"=> range(1,6),
"ធីម៉ូថេ ទី២"=> range(1,4),
"ទីតុស"=> range(1,3),
"ភីលេម៉ូន"=> range(1,1),
"ហេព្រើរ"=> range(1,13),
"យ៉ាកុប"=> range(1,5),
"ពេត្រុស ទី១"=> range(1,5),
"ពេត្រុស ទី២"=> range(1,3),
"យ៉ូហាន ទី១"=> range(1,5),
"យ៉ូហាន ទី២"=> range(1,1),
"យ៉ូហាន ទី៣"=> range(1,1),
"យ៉ូដាស"=> range(1,1),
"វិវរណៈ"=> range(1,22)
);
?>
<script type="text/javascript">
function OnChange(dropdown)
{
//reload page after drop down selection
dropdown.options[dropdown.selectedIndex].value;
}
</script>
</head>
<body>
<div id="foo"></div>
<div id="links">
<form action="">
<select name="chapter">
<?php
foreach ($books as $key => $value) {
echo '<option value="' . $key . '">' . $key . '</option>';
}
?>
</select>
<br>
<select name="book">
<option value="">Select</option>
</select>
</form>
</div>
謝謝。我會稍微嘗試一下,讓你知道它是如何工作的。 – preahkumpii 2012-03-29 09:33:49
這不可能更完美。非常感謝。 – preahkumpii 2012-04-03 08:53:00