www.webdeveloper.com
Results 1 to 3 of 3

Thread: combining input text filed and pulldown as search field please help !!

  1. #1
    Join Date
    May 2006
    Posts
    3

    combining input text filed and pulldown as search field please help !!

    Hello can someone help me with this problem that I am having. I want to put a text field where the user type in and a pull down drop box where they select either first name or last name. I have an .asp code to work already with the text field but I can't combine a text field and drop down box to work. I currently have a two working text box and I want to combine one text box with the drop down with 2 fields for first name and last name.
    This is what I have:

    <form action="firstname.asp" method="get">
    <input name="search" value="" size="25" />
    <input type="submit" value="Search"/>

    <form action="lastname.asp" method="get">
    <input name="search" value="" size="25" />
    <input type="submit" value="Search"/>

  2. #2
    Join Date
    Apr 2006
    Posts
    73
    man u need to make some combinations wid if and else...in da next page..!
    r u handling dis case>>> wat if da user does not enter any text, i.e he only wants to search wid da combo box...and not anything written in text box??
    be more specific and i'll help u out...dis is very simple my frnd..!

  3. #3
    Join Date
    May 2006
    Posts
    3
    Thank you omarr226 for your reply..I thought there's no help for this....Well let me explain what I want to do...I have an access database of my musics collection. I want to setup a search webpage with 1 text box where I can type in anything. And a drop/pull down box for me to specify if I want to search by artist name, song title, or disc number. If I don't type anything in the text box and click submit..then just do nothing. Here's my working asp code:

    <%
    Dim myWhere
    Dim strURL
    Dim cnnSearch
    Dim rstSearch
    Dim strDBPath
    Dim strSQL
    Dim strSearch
    Dim strSort
    Dim objField ' Used for table display


    strURL = Request.ServerVariables("URL")

    strSearch = Request.QueryString("search")

    strSort = Request.QueryString("strSort")

    If strSearch <> "" Then

    strDBPath = Server.MapPath("/anhlunnhaque/db/karaoke_full.mdb")


    Set cnnSearch = Server.CreateObject("ADODB.Connection")


    cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

    Select Case strSort
    Case "mfcode"
    myWhere = "mfcode,track"
    Case "track"
    myWhere = "track,song"
    Case "song"
    myWhere = "song"
    Case Else
    myWhere = "artist"
    End Select


    strSQL = "SELECT mfcode,track,song,artist " _
    & "FROM AllEng100705 " _
    & "WHERE mfcode LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
    & "ORDER BY " & myWhere &""

    Set rstSearch = cnnSearch.Execute(strSQL)

    %>
    <center><table border="1" bordercolor="#0000FF">
    <body vlink="#FF0000" alink="#FF0000">
    <tr>
    <% strSearch = Server.URLEncode(strSearch) ' do NOT do this BEFORE this point! %>
    <th bgcolor="#CCCCCC"><a href="emfc.asp?search=<%=strSearch%>&strSort=mfcode"><font color = "#FF0000">Disc Code</a></font color></th>
    <th bgcolor="#CCCCCC"><a href="emfc.asp?search=<%=strSearch%>&strSort=track"><font color = "#FF0000">Track Number</a></font color></th>
    <th bgcolor="#CCCCCC"><a href="emfc.asp?search=<%=strSearch%>&strSort=song"><font color = "#FF0000">Song Title</a></font color></th>
    <th bgcolor="#CCCCCC"><a href="emfc.asp?search=<%=strSearch%>&strSort=artist"><font color = "#FF0000">Artist Name</a></font color></th>
    </td>
    </tr></body>
    <%

    blnColor = False
    rstSearch.MoveFirst
    Do While Not rstSearch.EOF
    Response.Write vbTab & "<tr>" & vbCrLf
    For Each objField in rstSearch.Fields
    Response.Write vbTab & vbTab & "<td bgcolor="""


    If blnColor Then
    Response.Write "#CCCCFF" ' Light blueish
    Else
    Response.Write "#FFFFFF" ' White
    End If

    Response.Write """>" & Trim(objField.Value) & "</td>" & vbCrLf
    Next 'objField
    Response.Write vbTab & "</tr>" & vbCrLf

    blnColor = Not blnColor

    rstSearch.MoveNext
    Loop
    %>
    </table></center>
    <%

    rstSearch.Close
    Set rstSearch = Nothing
    cnnSearch.Close
    Set cnnSearch = Nothing
    End If


    %


    P.S. On the same note: How would I do or create links to my searched resutls so that when I click on the artist name..It'll pull up all the songs by that artist. ?? For example. I type in the song title "Gold Digger". The results will display like this:

    Disc Number: Song Title: Artist: Track:
    CD1 Gold Digger Kayne West, Jamie Fox 1


    I want the text "Kayne West, Jamie Fox" to be a link so that if I click on Kayne West...it'll refreshh and pulled all the songs by him. Like wise for Jamie Fox...if I click on it..it'll refresh and pull all the songs by Jamie Fox.


    Please please help me...

    Thank you so much !!!!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles