- <?php
- if($_POST){
- $arr_paixu=$_POST['paixu'];
- $arr_name=$_POST['name'];
- print_r($arr_paixu);
- echo '<br />';
- print_r($arr_name);
- echo '<br />';
- $new_arr=array_combine($arr_paixu,$arr_name); //数组对应合并
- print_r($new_arr);
- }
- ?>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html;charset=gbk">
- <script language="javascript">
- <!--
- function onclick_updown(updown, order){
- var o_order, n_order;
- o_order = order;
- o_innerHTML = document.getElementById("name_" + o_order).value;
- if (updown == "down"){
- n_order = order + 1;
- }
- else{
- n_order = order - 1;
- }
- n_innerHTML = document.getElementById("name_" + n_order).value;
- document.getElementById("name_" + o_order).value = n_innerHTML;
- document.getElementById("name_" + n_order).value = o_innerHTML;
- }
- //-->
- </script>
- </head>
- <body>
- <form action="" method="post">
- <input type="text" name="paixu[]" value="1" /><input type="text" name="name[]" id="name_1" value="第一个" /><a href="#" onclick="onclick_updown('down', 1)">下移</a><br />
- <input type="text" name="paixu[]" value="2" /><input type="text" name="name[]" id="name_2" value="第二个" /><a href="#" onclick="onclick_updown('up', 2)">上移</a><a href="#" onclick="onclick_updown('down', 2)">下移</a><br />
- <input type="text" name="paixu[]" value="3" /><input type="text" name="name[]" id="name_3" value="第三个" /><a href="#" onclick="onclick_updown('up', 3)">上移</a><a href="#" onclick="onclick_updown('down', 3)">下移</a><br />
- <input type="text" name="paixu[]" value="4" /><input type="text" name="name[]" id="name_4" value="第四个" /><a href="#" onclick="onclick_updown('up', 4)">上移</a><br />
- <br /><br />
- <input type="submit" value="提交" />
- </form>
- </body>
- </html>