[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating search boxes

Posted on 2002-07-24
5
Medium Priority
?
137 Views
Last Modified: 2013-12-23
I have an employee table with first, last & middle name. I need to create a search box where the user will enter part of the last name and all available matches (Last, First, M) will appear in a box. Then the user should be able to select one of the names to query for information.

Example:

User enters
"Jone"

Interdev returns
"Jones, Ben R."
"Jones, Raymond Q."
"Jones, Stacy M."

User clicks on "Jones, Raymond Q." and the main info screen appears for that employee.

Thanks in advance for your help!
0
Comment
Question by:StacyWest
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 19

Accepted Solution

by:
DreamMaster earned 300 total points
ID: 7188207
That doesn't seem so hard..

All you do is create a query that fills the listbox.

Something like this:

sSQL = "SELECT ID, Lastname, Firstname from tblEmployee where Lastname like '%" & Request.Form("inpSearchTxt") & "%'"

This inpSearchTxt comes from a textfield with that name.

So your form will look like this initially:

<form name="frmEmployeeSearch" action="EmployeeSearch.asp" method="post">
  <input type="textbox" name="inpSearchTxt">
  <input type="submit" name="inpSubmit" value="Search">
  ...
</form>

Now to make the populated listbox appear when you have send the query... fill in the following at the dots:

<%
  If (Request.Form("inpSearchTxt") <> "") then
%>
  <select name="selEmployees" onchange="location.href=this[this.selectedIndex].value">
<%
   ' Your routines for opening the database go here.
   sSQL = "Select ID, Lastname, Firstname from tblEmployee where Lastname like '%" & Request.Form("inpSearchTxt") & "%'"
   Set rs=DB.Execute (sSQL)
   if not (rs.eof and rs.bof) then
     do while not rs.eof
      %>
      <option name="<%= rs("Lastname") & "-" & rs("Firstname") %>" value="employeedetails.asp?id=<%=rs("ID")%>"><%= rs("Lastname") & ", " & rs("Firstname") %></option>
      <%
       rs.movenext
     loop
    end if
%>
  </select>
<%
  end if
%>

Good luck, I hope this points you in the right direction...

Max.
0
 
LVL 1

Expert Comment

by:worldspawn
ID: 7296591
What exactly does this have to do with interdev?
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question