Hi everybody Firstly thk jean helpful ! The program have been modified, but also failed ! When I run the program and select the A only after submit the form, but the result are $user_options[0] = D,$user_select[1] =, $user_select[2] = and $user_select[3] =. Why it should be $user_select[0]=A only ? Also same problem Try to run the program. it okay ! Here is the full program (testing.php) ============================================ <?php session_register("user_options"); ?> <?php include ("./jscript4.ini"); $user_options; switch($action) { case "submit": for($i=0 ; $i<5 ; $i++) { echo "user_options[$i] = $user_options[$i]"; echo "<p>"; } break; default: display_screen(); break; } function display_screen() { global $user_options; echo "<head>"; echo "<title>Testing</title>"; echo "</head>"; echo "<body bgcolor=#FFFFFF text=#000000>"; echo "<hr>"; echo "<p>"; echo "<form name=form1 method='get'>"; echo "<input type=hidden name=action value='submit'>"; ?> <table width="20%" border="1"> <tr> <td> <select name="select1" size="4" > <option value="A">A <option value="B">B <option value="C">C <option value="D">D </select> </td> <td> <input type="button" value="-->" onClick="createOptions()"> <p> </td> <td> <select name="select2" size="4"> <option value="" > You Selected <option value="" > --------------- </select> </td> </tr> </table> <hr> <br> <br> <p> <center> <p> <? //initial user_options data = "0" $user_options[0] = '0'; echo "<input type=Submit name=action value=submit onClick=\"ViewOptions()\"> "; echo "<input type='reset' name='Submit2' value='Reset'>"; ?> </center> </P> </form> </body> <script> <!-- function ViewOptions() { alert("debug1 user_options = <? echo "$user_options[0]"; ?> "); var item = document.form1.select2.options.length; if(item > 2) { <? $j=0; ?> for (var i=2; i<item; i++) { var temp = document.form1.select2.options[i].text; switch(temp) { case "A": alert("debug2 set user_options[<?echo "$j";?>] = A"); <?php $user_options[$j]='A'; ?> alert("debug3 user_options[<?echo"$j";?>] = <?echo "$user_options[$j]"; ?>"); break; case "B": alert("debug2 set user_options[<?echo "$j";?>] = B"); <?php $user_options[$j]='B';?> alert("debug3 user_options[<?echo"$j";?>] = <?echo "$user_options[$j]"; ?>"); break; case "C": alert("debug2 set user_options[<?echo "$j";?>] = C"); <?php $user_options[$j]='C';?> alert("debug3 user_options[<?echo"$j";?>] = <?echo "$user_options[$j]"; ?>"); break; case "D": alert("debug2 set user_options[<?echo "$j";?>] = D"); <?php $user_options[$j]='D';?> alert("debug3 user_options[<?echo"$j";?>] = <?echo "$user_options[$j]"; ?>"); break; } <? $j++; ?> } } alert("debug END"); } //--> </script> <? } ?> //Other part jscript4.ini file (jscript4.ini) ========================================== <script language="JavaScript1.1"> <!-- function createOptions(){ sel1 = document.form1.select1; sel2 = document.form1.select2; var num = sel1.selectedIndex; var option = new Option(sel1.options[num].text); var item = sel2.options.length; sel2.options[item] = option; sel1.selectedIndex = 10000; } //--> </script> ---------------------------------------------- 歡迎使用HongKong.com郵件系統 Thank you for using hongkong.com Email system -- PHP Install Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]