devxlogo

Place Selected Data From Listbox Into Global Variable

Place Selected Data From Listbox Into Global Variable

Question:

I need to put a selected item from a drop-down listbox into a global variable. The listbox is named select1. Here is my code:

<%dim strDatastrData = Request.Form ("select1")Application("Currentfile") = strData %> 

When I go the next page, the Currentfile variable is Empty.

Answer:

Are you sure there is data in the strData variable? Check for that first, by adding response.write strData in your code. Next, check to see if your form is using a METHOD = GET or POST and change your Request… line accordingly to obtain the data from the QueryString or from the Form.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist