Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $countries = array(
- 0 => 'Norway',
- 1 => 'Denmark',
- 2 => 'Sweden'
- );
- ?>
- <html>
- <body>
- <script type="text/javascript">
- function removeItem(value) {
- var selObj = document.getElementById("dd2")
- for (var i = 0; i < selObj.length; i++) {
- if (selObj.options[i].value == value ) selObj.remove(i);
- }
- }
- </script>
- <select onchange="removeItem(this.value);">
- <?php
- for ($i = 0; $i < count($countries); $i++) {
- echo '<option value="' . strtolower($countries[$i]) . '">' . $countries[$i] . '</option>';
- }
- ?>
- </select>
- <select id="dd2">
- <?php
- for ($i = 0; $i < count($countries); $i++) {
- echo '<option value="' . strtolower($countries[$i]) . '">' . $countries[$i] . '</option>';
- }
- ?>
- </select>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement