Ik heb de volgende code:
url: http://dev1.topsite.nl/test.php
Ik pas dus middels javascript de volgorde aan.
Na het submitten worden de verstuurde waarden getoond.
Hieruit blijkt dus dat de originele volgorde wordt verstuurd en NIET de aangepaste volgorde.
Kan iemand mij vertellen wat ik fout doe en eventueel aangeven hoe ik het aan moet pakken?
url: http://dev1.topsite.nl/test.php
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>test</title> <script type="text/javascript" language="javascript"> function move(index,to) { var list = document.getElementById('list'); var total = list.options.length-1; if (index == -1) return false; if (to == +1 && index == total) return false; if (to == -1 && index == 0) return false; var items = new Array; var values = new Array; for (i = total; i >= 0; i--) { items[i] = list.options[i].text; values[i] = list.options[i].value; } for (i = total; i >= 0; i--) { if (index == i) { list.options[i + to] = new Option(items[i],values[i + to], 0, 1); list.options[i] = new Option(items[i + to], values[i]); i--; } else { list.options[i] = new Option(items[i], values[i]); } } list.focus(); } function toggleList(blnSelect){ var list = document.getElementById('list'); var total = list.options.length-1; for (i = total; i >= 0; i--){ list.options[i].selected = blnSelect; alert('Value: '+list.options[i].value+' - Text: '+list.options[i].text); } return blnSelect; } </script> </head> <body> <form onsubmit="return toggleList(true);" method="post" action="" name="form"> <select name="list[]" size="5" multiple="multiple" id="list" style="width: 200px;"> <option value="optie1">optie 1</option> <option value="optie2">optie 2</option> <option value="optie3">optie 3</option> <option value="optie4">optie 4</option> <option value="optie5">optie 5</option> </select> <p> <a href="javascript:void(0);" onclick="javascript:move(document.getElementById('list').selectedIndex,-1)";>omhoog</a><br /> <a href="javascript:void(0);" onclick="javascript:move(document.getElementById('list').selectedIndex,+1)";>omlaag</a><br /> <a href="javascript:void(0);" onclick="javascript:toggleList(true);">alles selecteren</a><br /> <a href="javascript:void(0);" onclick="javascript:toggleList(false);">reset</a> </p> <input type="submit" name="Submit" value="Submit" /> </form> <? print '<pre>'; print_r($_POST['list']); print '</pre>'; ?> </body> </html> |
Ik pas dus middels javascript de volgorde aan.
Na het submitten worden de verstuurde waarden getoond.
Hieruit blijkt dus dat de originele volgorde wordt verstuurd en NIET de aangepaste volgorde.
Kan iemand mij vertellen wat ik fout doe en eventueel aangeven hoe ik het aan moet pakken?