Hi Guys,

I am sorry to bother everyone but this one is really really touch one for me.. any suggestions???

I am looking to the data into a javascript which in turn will be loaded into another drop down list..

I can see that javasript is created for me with the asp code but whenever I try and change the category value I receive a javascript error..

Anyone to help this poor soul... who is about to give uppp!


<%
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
''connstring = "driver={sqlserver};server=myserver;uid=validuser;pwd=validpwd;"

sqlstring = "select * from occulist"
set rs = conn.execute(sqlstring)
x=0
%>

<script language = JavaScript>
function subcat()
{
cat = document.subad.catagory[document.subad.catagory.selectedIndex].value;
url = "submitad.asp?cat="
url = url + cat;
window.location.href = url;
}
function sublist(inform, selecteditem)
{
inform.subcatagory.length = 0
<%
count= 0
y=0
do while not rs.eof
%>
x = <%= trim(y) %>
subcat = new Array();
subcatagorys = "<%= trim(rs("Name"))%>"
subcatagoryof = "<%= trim(rs("CatID"))%>"
subcatagoryid = "<%= trim(rs("Points"))%>"
subcat[x,0] = subcatagorys;
subcat[x,1] = subcatagoryof;
subcat[x,2] = subcatagoryid;
if (subcat[x,1] == selecteditem)
{
var option<%= trim(count)%> = new Option(subcat[x,0], subcat[x,2])inform.subcatagory.options[inform.subcatagory.length]=option <%= trim(count)%>
}
<%
count = count + 1
y = y + 1
rs.movenext
loop
%>
}
</script>
<title>Submit an Ad</title>
<LINK rel="stylesheet" type="text/css" href="style/summary.css">
</head>
<BODY>

<form name = subad action = "thankyouad.asp" >
<table>
<tr>
<td><textarea name = "description" rows = 5 cols = 50></textarea></td>
</tr>
<%
cat = Request.QueryString("cat")
sqlstring = "SELECT Categories.* from categories"
set rs = conn.execute (sqlstring)
%>
<tr>
<td>Catagory</td>
</tr>
<tr>
<td><SELECT id=catagory name=catagory onchange="sublist(this.form, document.subad.catagory[document.subad.catagory.selectedIndex].value)">
<OPTION selected value=""></OPTION>
<%
do until rs.eof
%>
<OPTION value="<%= rs("ID")%>"><% = rs("CatName")%></OPTION>
<%
rs.movenext
loop
set rs = nothing
%>
</SELECT></td>
</tr>
<tr>
<td><SELECT id = "subcatagory" name="subcatagory">
<Option selected value="none">-------------------------</option>
</SELECT>
</td>
</tr>
<tr>
<td>Price</td>
<tr>
<tr>
<td><INPUT type="text" id=price name=price></td>
</tr>
<td><Input type=submit value = "Submit" id=submit1 name=submit1 ></td>
</tr>
</table >
</form>

</body> </html>