468,292 Members | 1,456 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,292 developers. It's quick & easy.

Pass dropdown Item to session variable

I am using the code below to open another page depending on what is
selected. This is working ok but I would like to streamline it so that I
will hot have to create a page everytime a new category code is added. How
can I pass the category code to another page as a variable after it is
selected? That way I would only need one page that can be used for all
categories.

Thanks
Carmen

<select name="ListBoxURL" size="1" language="javascript"
onchange="gotoLink(this.form);">
<option selected>Open Report by Category Code
<%
While not rs.EOF
%>
<option
value="Action_Items/<%=rs("category_code")%>_start.asp"><%=rs.fields(" category_code")%>
<%
rs.MoveNext
Wend
rs.Close
%>
</select>
</p>
<script language="JavaScript">
<!--
function gotoLink(form) {
var OptionIndex=form.ListBoxURL.selectedIndex;
parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script>
Jul 22 '05 #1
1 3702
So, wait, you have files named category1_start.asp, category2_start.asp, and
so on?

This is what ASP is meant to overcome. Pass the category ID to your page
and query the data accordingly.

<select onchange="location.href='display.asp?catid='+this. value;">
<% Do while not.....
<option
value="<%=rs("category_code")%>"><%=rs("category_c ode")%></option>

And then on display.asp

<%
Dim catID
catID = Request.Querystring("catid")
%>

And from there, query your database and get whatever it is you need to
display based on the category ID that was passed.

Ray at work

"carmen" <carmen@iyahoo_Spam.com> wrote in message
news:Oz****************@tk2msftngp13.phx.gbl...
I am using the code below to open another page depending on what is
selected. This is working ok but I would like to streamline it so that I
will hot have to create a page everytime a new category code is added. How
can I pass the category code to another page as a variable after it is
selected? That way I would only need one page that can be used for all
categories.

Thanks
Carmen

<select name="ListBoxURL" size="1" language="javascript"
onchange="gotoLink(this.form);">
<option selected>Open Report by Category Code
<%
While not rs.EOF
%>
<option
value="Action_Items/<%=rs("category_code")%>_start.asp"><%=rs.fields(" catego
ry_code")%> <%
rs.MoveNext
Wend
rs.Close
%>
</select>
</p>
<script language="JavaScript">
<!--
function gotoLink(form) {
var OptionIndex=form.ListBoxURL.selectedIndex;
parent.location = form.ListBoxURL.options[OptionIndex].value;}
//-->
</script>

Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by passion_to_be_free | last post: by
1 post views Thread by crjunk | last post: by
3 posts views Thread by John | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.