// Select.php //
****************
<script type="text/javascript">
function goto(path) {
window.location.href = path;
}
function fnMoveItems(lstbxFrom,lstbxTo)
{
var varFromBox = document.frm.elements[lstbxFrom];
var varToBox = document.frm.elements[lstbxTo];
if ((varFromBox != null) && (varToBox != null))
{
if(varFromBox.length < 1)
{
alert('There are no items in the source ListBox');
return false;
}
if(varFromBox.options.selectedIndex == -1) // when no Item is selected the index will be -1
{
alert('Please select an Item to move');
return false;
}
while ( varFromBox.options.selectedIndex >= 0 )
{
var newOption = new Option(); // Create a new instance of ListItem
newOption.text = varFromBox.options[varFromBox.options.selectedIndex].text;
newOption.value = varFromBox.options[varFromBox.options.selectedIndex].value;
varToBox.options[varToBox.length] = newOption; //Append the item in Target Listbox
varFromBox.remove(varFromBox.options.selectedIndex); //Remove the item from Source Listbox
}
}
return false;
}
function mydata()
{
var sel="";
var obj;
var j;
obj=document.frm.RightBox1;
for(j=0;j<obj.options.length;j++) {
sel+=obj.options[j].value+":";
}
document.frm.selected1.value=sel;
}
</script>
************************
<html>
<body>
<form name="frm" method="post" action="view.php" onSubmit=" return mydata();">
<br/>
<table width="42%" border="0" cellspacing="1" cellpadding="0">
<tr>
<th width="19%" scope="row"><select name="LeftBox1" size="4" multiple style ="text-transform:capitalize;width:140px;">
<option value="First Select">First Select</option>
<option value="Second select">Second Select</option>
<option value="Second select">Third Select</option>
<option value="Second select">Forth Select</option>
</select></th>
<td width="7%"><input type = "button" value = ">>" onclick = "fnMoveItems('LeftBox1','RightBox1')"; />
<input type = "button" value = "<<" onclick = "fnMoveItems('RightBox1','LeftBox1')"; /></td>
<td width="74%"><select name="RightBox1" size="4" multiple style ="text-transform:capitalize;width:140px;">
<option></option>
</select>
<input type="hidden" name="selected1" value="">
<input type="submit" name="button1" value="Get Value" /></td>
</tr>
</table>
</form>
</body>
</html>
// View.php page //
********************
<?php
$view=$_REQUEST['selected1'];
$array1=explode(":", $view);
print "<pre>";
print_r($array1);
print "</pre>";
?>
[ add comment ] ( 3 views ) | permalink |




( 3 / 16 )
Calendar



