[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 142
  • Last Modified:

ASP: Retrieving database data using drop-down menu

I am trying to retrieve data from an ACCESS database in ASP code such as

 sql="SELECT * FROM tablewithdata WHERE mydata =' & request("myformdata") & ' "

This is working if MYFORMDATA is the name element of a INPUT textbox-stand alone- on my form but it is not working if this is the name of the SELECT element of a drop-down menu with a number of options.

What am I missing??
Its a simple question but I will not be mean with the points!

Billy
0
billysaw
Asked:
billysaw
  • 2
1 Solution
 
nurbekCommented:
check the drop down menu name

it may conflict with another form element

try to check the value  
response.write (Request("dropdown_name"))

0
 
billysawAuthor Commented:
JUST TO MAKE SURE:

Is the "dropdown_name" the name of the FORM or the name of the SELECT?
0
 
nurbekCommented:
name of the SELECT box
0
 
techjoshCommented:
A select list contains options which each have their own value... make sure that the option you select has a value or Request("dropdown_name") will have a null value (or maybe an empty string?)... like this:

<select name="dropdown_name">
  <option>Select Color</option>             <-- returns ""
  <option value="FF0000">Red</option> <-- returns "FF0000"
  <option value="00FF00">Green</option> <-- returns "00FF00"
  <option value="0000FF">Blue</option>  <-- returns "0000FF"
</select>

so, if the option you selected has no value the sql statement looks like this:
SELECT * FROM tablewithdata WHERE mydata = ''
which is probably not what you want...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now