Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Sep 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Posting hyperlink from database

    I have a current search that allows you to select a specific state, forward to the next page and shows all dealers located in that state. What I would like to do is add dealers url link on that page. How do I go about posting a hyperlink. The link to the webpage is http://www.tiasdancewear.com/dealersearch.asp the way I would enter the data into the database is www.thesite.com Here is a snip of the code that I have so far:

    end if
    response.write("<td><a href=customerinfo.asp?customer=" &rsCustomers.Fields("customerID") & ">" & server.HTMLEncode (rsCustomers.Fields("customer")) & "</a></td>")
    response.write("<td>" & server.HTMLEncode (rsCustomers.Fields("city")) & "</td>")
    response.write("<td>" & server.HTMLEncode (rsCustomers.Fields("name")) & "</td>")
    response.write("<td> "<a href=""&rsCustomers.Fields("link")">" "</a></td>")
    response.write("</tr>")
    row = row+1
    rsCustomers.MoveNext
    loop
    response.write("</table>")
    end if

    All help is appreciated.

    Thanks
    Wayne

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    response.write("<td><a href=""" & rsCustomers.Fields("link") & """></a></td>")
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Sep 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That cleared up the error that I was getting, thank you. Now it still is not posting the link on the page. Here is the link to the test search for this: http://www.tiasdancewear.com/dealersearchtesting2.asp I only have 1 url to test it under Alabama Not all dealers will have a url. Here is the code that I now have:
    response.write("<td><a href=""" & rsCustomers.Fields("link") & """> " & server.HTMLEncode (rsCustomers.Fields("link")) & "</a></td>")

    Thanks again for the help.

    Wayne

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    strLink = rsCustomers.Fields("link")
    if strLink<>"" and not isnull(strLink) then
    response.write("<td><a href=""" & strLink & """>" & strLink & "</a></td>")
    else
    response.write("<td>No link</td>")
    end if
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New Coder
    Join Date
    Sep 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you again... I added the code that you posted and it work BUT it is wanting to send me to http://www.tiasdancewear.com/www.testing.com I tried a few things that I though would work with no success. What do I need to add to make it just link to www.testing.com?

    Thanks again,
    Wayne

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    make it an absolute url by putting http:// in front of the url.

    strLink = rsCustomers.Fields("link")
    if strLink<>"" and not isnull(strLink) then
    response.write("<td><a href=""http://" & strLink & """>" & strLink & "</a></td>")
    else
    response.write("<td>No link</td>")
    end if

    just make sure all the contents in the field "link" saved in the database does not start with http://
    if it can contain that string, you can check it first:

    strLink = rsCustomers.Fields("link")
    if strLink<>"" and not isnull(strLink) then
    if instr(1,strLink,"http://")=0 then strHttp = "http://" else strHttp=""
    response.write("<td><a href=""" & strHttp & strLink & """>" & strLink & "</a></td>")
    else
    response.write("<td>No link</td>")
    end if
    Last edited by glenngv; 02-21-2003 at 04:52 AM.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #7
    New Coder
    Join Date
    Sep 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, worked perfectly. I was just missing a few "

    Thanks
    Wayne


  •  

    Posting Permissions

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