dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: hyperlinks in database search page

  1. #1
    Join Date
    Nov 2002
    Posts
    2

    Question hyperlinks in database search page

    hi everyone,
    i hope someone knows how to do this,
    i have a database and 2 of the fields are email and website.
    i need to make them hyperlinks.
    here is my code please help!
    <%@LANGUAGE=VBSCRIPT%>
    <!--#include file="adovbs.inc"-->
    <html>
    <head><title>search</title>
    </head>
    <body>
    <body bgcolor="#FFFFFF" text="#OOOOOO" link="66OOOO"
    vlink="#oo3399"alink="#999933">
    <font face="Arial,Helvetica">
    <center>
    <img border="0" scr="images/main.gif">
    <% If (Request.Form("searchtext") ="") Then %>
    <h1 Class="header"><font size="3"face="Trebuchet MS">Search for
    Provider</font>
    <font face="Verdana" size="3"><B>&nbsp;</B></font></h1>
    <Form Method=Post>
    </font><Table Border="1" bordercolordark="#999966"
    bordercolorlight="CCCC99">
    <TR>
    <TD bgcolor="D#D8CB"><font face="Arial,Helvetica">Salon:<br>
    <input name="searchtext"size=30 maxlenght=64>
    </font></TD>
    <TD bgcolor="#D3D8CB"><font face="Arial,Helvetica">Field to Search:
    <SELECT NAME="searchfield">
    <OPTION VALUE="name"> name
    <OPTION VALUE="address">address
    <OPTION VALUE="city">city
    <OPTION VALUE="state">state
    <OPTION VALUE="zip">zip
    <OPTION VALUE="country">country
    </SELECT>
    </font></TD>
    </TR>
    <TR>
    <TH COLSPAN=2><font face="Arial,Helvetica"><INPUT TYPE=SUBMIT><INPUT
    TYPE=RESET>
    </font></TH>
    </TR>
    </TABLE><font face="Arial,Helvetica">
    </FORM>
    <%ELSE
    searchfield = Request.Form("searchfield")
    searchtext = Request.Form("searchtext")
    %>
    <H1 CLASS="header"><br>
    <font size="3">&nbsp;Search Results</font></H1>

    <%Set Conn = Server.CreateObject("ADODB.Connection")

    connectstring = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\raphaelbasante\db\salons.mdb")

    conn.Open connectstring
    part1 = "SELECT * FROM salons "

    If(searchfield = "zip")Then
    part2 = " WHERE " & searchfield & " = " & searchtext
    Else
    part2 = " WHERE " & searchfield & " = '" & searchtext & "'"
    End IF
    part3 = " ORDER BY name , address "
    stmt = part1 & part2 & part3
    Set rs=Server.CreateObject("ADODB.Recordset")
    rs.Open stmt , conn

    %>
    </font><TABLE BORDER=1>
    <TR>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">ID</font></TH>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">name</font></TH>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">address</font></TH>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">city</font></TH>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">state</font></TH>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">zip</font></TH>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">country</font></TH>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">Email</font></th>
    <TH bgcolor="#D3D8CB"><font face="ARIAL,Helvetica">website</font></TH>
    <%Do Until rs.EOF%>
    <TR>
    </TD>
    <%For Each field In rs.fields
    If field.Value<> "" Then%>
    <TD><font face="ARIAL,Helvetica"><%=Server.HTMLEncode(field.Value)%>
    </td>
    <%Else%>
    <td>No match found</font></td>
    <%End If
    Next%>

    </TR>
    <%rs.MoveNext%>
    <%Loop%>
    </Table>
    <%
    rs.close
    Set rs = Nothing
    conn.Close
    %>
    <%End IF%>
    </center></font></body>
    </html>

  2. #2
    Join Date
    Nov 2002
    Posts
    2

    Smile thanks got it

    Thank you
    that was where i needed to fix it and i got it.

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