this my codes. i can not send strChosenItems values to index.php using form. how can i do it ?
<script type="text/javascript">
function OnTransferBtnClick(blnFromLeft)
{
var LeftListBox = document.forms[0].lstLeft;
var RightListBox = document.forms[0].lstRight;
var ListItems = new Array();
FromList = (blnFromLeft ? LeftListBox : RightListBox);
ToList = (blnFromLeft ? RightListBox : LeftListBox);
for(var i=(FromList.options.length - 1);i>=0;i--)
if(FromList.options[i].selected)
{
ListItems[ListItems.length] = new Option(FromList.options[i].text);
FromList.options[i] = null;
}
for(var i=ListItems.length - 1;i>=0;i--)
ToList.options[ToList.options.length] = ListItems[i];
}
function OnBtnSubmitClick()
{
ListBox = document.forms[0].lstRight;
if(ListBox.options.length==0)
alert("You did not selection any item/items. Please choose an item/items from the left list box and transfer them to the right list box");
else
{
var strChosenItems = "";
for(var i=0;i<ListBox.options.length;i++)
strChosenItems = strChosenItems + " " + ListBox.options[i].text;
alert("You chose : " + strChosenItems);
}
}
</script>
</head>
<body bgColor="#FFFFF0">
<form Name="SomeForm" method="POST" action="index.php">
<table>
<tr>
<td>
<select name="lstLeft" MULTIPLE size="5">
<?php
$link = mysql_connect("localhost","root","123");
if(!$link){
echo mysql_error();
}
mysql_select_db("db",$link);
$sql = "SELECT * FROM vb_user LIMIT 20";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
while ($row = mysql_fetch_assoc($result)) {
/* echo $row["userid"]."-".$row["username"]."-".$row["password"]."-".$row["email"]."<br/>";*/
echo '<Option>'.$row["username"].'</Option>';
}
?>
</select>
</td>
<td>
 
</td>
<td>
<table>
<tr>
<td>
<input Type="Button" Name="btnLtoR" Value=">>" onClick="OnTransferBtnClick(true)" title="Transfer Items Selected in the Left List Box to the Right List Box">
</td>
</tr>
<tr>
<td>
<input Type="Button" Name="btnRtoL" Value="<<" onClick="OnTransferBtnClick(false)" title="Transfer Items Selected in the Right List Box to the Left List Box">
</td>
</tr>
</table>
</td>
<td>
 
</td>
<td>
<select name="lstRight" MULTIPLE size="5">
</select>
</td>
</tr>
<tr>
<td>
<input Type="Submit" Name="btnSubmit" Value="OK" onClick="OnBtnSubmitClick()" Title="Submit this form">
</td>
</tr>
</table>
</form>
</body>
</html>