Hello,

Please help me with this. Copy this code and view it in your browser.

It has 2 listboxes. The one has the values option1 thru option6 on it and
whatever option you select is then placed in the second listbox. You can
move the selected options from the one listbox to the other as you wish.

You will see that I have a code/specified value for each option in the listbox
eg. option 1 = opt1, option 2 = opt2 etc etc.

My aim with this page is to select certain records (depending on what the user selected)
from a table in my db. Now, I know ASP, but not Java and this is where I need
anyones help. What I want to have is that when the user clicks the submit button, after
selecting whatever options he want, I want to build a sql statement --- something like
"select * from products where prodcode in (var1,var2,var3)" --- where var1,var2,var3
is the "specified value"(eg opt1 or opt2) which the user selected before submitting.

If you can just help me with the code to the point where the sql statement is built -
ie.. after the submit button is clicked, just do a response.write with the correct sql statement
as explained above.

PLEEEASSEEE!! Anyone - I know I'm asking a lot here - and a lot of your time, but I desperately
want to get this going!!

Thanks,
T

.....here's what code I have so far - it works 100% - just copy and paste


code:-
<script language="JavaScript"><!--
function deleteOption(object,index) {
object.options[index] = null;

}

function addOption(object,text,value) {
var defaultSelected = true;
var selected = true;
var optionName = new Option(text, value, defaultSelected, selected)
object.options[object.length] = optionName;
}

function copySelected(fromObject,toObject) {
for (var i=0, l=fromObject.options.length;i<l;i++) {
if (fromObject.options[i].selected)
addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
}
}


function getIndex(toobject) {
for (var i=toobject.options.length-1;i>-1;i--) {
if (toobject.options[i].selected)
toobject.options[i] = null;;
}
}




//--></script>

<html>

<head>
<title></title>
</head>

<body>

<form>
<table>
<tr>
<td><select name="select1" size="25"
style="font-family: Arial; font-size: 8pt; background-color: rgb(0,0,128); color: rgb(255,255,255); border: medium ridge">
<option value="op1">option1</option>
<option value="opt2">option2</option>
<option value="opt3">option3</option>
<option value="opt4">option4</option>
<option value="opt5">option5</option>
</select>&nbsp; <p>&nbsp;</td>
<td><input type="button" value=" &gt; "
onClick="if (document.images) copySelected(this.form.select1,this.form.select2)"> <p><input
type="button" value=" &lt; " onClick="if (document.images) getIndex(this.form.select2)"> </td>
<td><blockquote>
<p><select name="select2" size="15"
style="font-family: Arial; font-size: 8pt; background-color: rgb(0,0,128); color: rgb(255,255,255); border: medium ridge">
</select> </p>
<p>&nbsp;</p>
<div align="center"><center><p><input type="submit" value="Submit" name="B1"></p>
</center></div>
</blockquote>
</td>
</tr>
</table>
</form>
</body>
</html>