URLs in Microsoft Access Databse

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gblack301
    New Member
    • Mar 2007
    • 17

    URLs in Microsoft Access Databse

    Hi,
    I have a Access database which stores organizations' webistes. When my asp form displays the website column it adds the search directory website instead displaying the website itself. I'm not sure if this makes sense but here is a example:

    When click ,I want the page to go www.website.com. Right now is going to something like www.organization.com/search/www.website.com.

    Here's me code:
    Code:
      <%
    If Len(fp_rs("Website"))>2 then
     Response.Write "<a target=""_blank"" href=" &fp_rs("Website") & Chr(34) & ">"  & FP_FieldVal(fp_rs,"Website") & "</a>"
        	End If
    %>
    Any help would be greatly appreciated and sorry for any grammer or spelling error, I'm running off of two hours of sleep. Thanks

    Greg
    Last edited by jhardman; Sep 19 '08, 05:42 AM. Reason: put code in code tags. please note button marked #
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    And what does the generated HTML code look like? Does it say
    Code:
    <a target="_blank" href="www.website.com">www.website.com</a>
    or
    Code:
    <a target="_blank" href="www.organization.com/search/www.website.com">www.organization.com/search/www.website.com</a>
    ?

    Jared

    Comment

    • gblack301
      New Member
      • Mar 2007
      • 17

      #3
      Originally posted by jhardman
      And what does the generated HTML code look like? Does it say
      Code:
      <a target="_blank" href="www.website.com">www.website.com</a>
      or
      Code:
      <a target="_blank" href="www.organization.com/search/www.website.com">www.organization.com/search/www.website.com</a>
      ?

      Jared
      Hi Jared,
      Thanks for the response, I have placed the 'target =_blank' into the my response.write statement and get the same results. The field is diplayed as www.website.com in my asp form but the hyperlink is targeting to www.organizatio n.com/search/www.website.com . For some reason the link is be added to the root of the search directory page. The acutally field in the database is called website which stores the URL. I'm not sure is this make sense. Thanks for your input.

      Greg

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        Originally posted by gblack301
        Hi Jared,
        Thanks for the response, I have placed the 'target =_blank' into the my response.write statement and get the same results. The field is diplayed as www.website.com in my asp form but the hyperlink is targeting to www.organizatio n.com/search/www.website.com . For some reason the link is be added to the root of the search directory page. The acutally field in the database is called website which stores the URL. I'm not sure is this make sense. Thanks for your input.

        Greg
        That's not exactly what I was asking. On the page that is behaving badly, hit control+u in firefox or go to the view menu --> Source in IE to show the HTML source code. What is the HTML source code for this line?

        Jared

        Comment

        • gblack301
          New Member
          • Mar 2007
          • 17

          #5
          Originally posted by jhardman
          That's not exactly what I was asking. On the page that is behaving badly, hit control+u in firefox or go to the view menu --> Source in IE to show the HTML source code. What is the HTML source code for this line?

          Jared
          Sorry about that. Please see below.

          Code:
          <tr> 
                <td width="60" style="padding:2; border-style:solid; border-width:1; " bgcolor=#DFFCA9 height="24">
                <font class="style6">
                <a target="_blank" href="Detail.asp?ID=3315">Complete Commissioning, Inc.</a></font></td>
                <td height="24" bgcolor=#DFFCA9 style="padding:2; border-style:solid; border-width:1; ">
                <font class="style6">
                </font>
                <font class="style6">   Clinton
                </font></td>
                <td width="42" style="padding:2; border-style:solid; border-width:1; " bgcolor=#DFFCA9 height="24">
                <font class="style6"> MD
                </font></td>
                <td width="87" style="padding:2; border-style:solid; border-width:1; " bgcolor=#DFFCA9 height="24">
                <font class="style6">301-877-2260
             </font></td>
                <td width="166" style="padding:2; border-style:solid; border-width:1; " bgcolor=#DFFCA9 height="24">
                	  <font class="style6">
                	  <a href="www.completecommissioning.com"> www.completecommissioning.com</a>
          </font> 
          	 
          	 </td>
                <td width="93" style="padding:2; border-style:solid; border-width:1; " bgcolor=#DFFCA9 height="24">
                <font class="style6">Capital-Mar Va 
               </font></td>
                <td width="99" style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2" bgcolor=#DFFCA9 height="24">
                <font class="style6">James Huber
          	</font></td>
                <td width="146" style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2" bgcolor=#DFFCA9 height="24">
                <font size="1"> <a href="mailto:jhuber@completecommissioning.com">jhuber@completecommissioning.com</a>
          	  	</font></td>
                <td width="21" style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2" bgcolor=#DFFCA9 height="24">
                <font class="style6">
                <input Type="CheckBox" checked>
                </font><font size="2">
          		</font></td>
                <td width="20" style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2" bgcolor=#DFFCA9 height="24">
                <font size="1">
                <input Type="CheckBox" checked>
                </font><font size="2">
          		</font></td>
                <td width="19" style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2" bgcolor=#DFFCA9 height="24">
                <font size="2">
          		<input Type="CheckBox" checked></font></td>
                <td width="19" style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2" bgcolor=#DFFCA9 height="24">
                <font size="2">
          		<input Type="CheckBox" checked></font></td>
                <td width="19" height="24" bgcolor=#DFFCA9 style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2">
                <font size="2">
          		<input Type="CheckBox" checked></font></td>
                <td width="19" height="24" bgcolor=#DFFCA9 style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2"><font size="2">
                  <input Type="CheckBox" checked>
                </font></td>
                <td width="19" height="24" bgcolor=#DFFCA9 style="border-style: solid; border-width: 1; padding-left: 0; padding-right:0; padding-top:2; padding-bottom:2"><font size="2">
                  <input type="CheckBox"        >
                </font></td>
          </tr>
          Here is the line in question. The html source code looks okay but when I roll over or click the link it takes me to 'www.nebb.org/DirectorySearch/www.compelecomi ssioning.com'. Thanks
          Greg

          Code:
           <td width="166" style="padding:2; border-style:solid; border-width:1; " bgcolor=#DFFCA9 height="24">
                	  <font class="style6">
                	  <a href="www.completecommissioning.com"> www.completecommissioning.com</a>
          </font> 
          	 
          	 </td>
          Last edited by JamieHowarth0; Sep 19 '08, 02:45 PM. Reason: Added code tags

          Comment

          • jeffstl
            Recognized Expert Contributor
            • Feb 2008
            • 432

            #6
            I'm confused because if your HTML source is showing the <a href> as the site you want to link to, it should be correct.

            Anyway I would try something like this if your not developing in a debug environment and can't step through to see the value of the RS("Website") variable

            Code:
            response.write RS("Website")
            Whatever is printed out should be the same thing printed inside the <a href>.

            You could also try putting an http:// in front of your string. Also I guess I'm not sure what the FP_Field is doing there (what its function is) but my code would look more like this.

            Code:
             Response.Write "<a href=" & fp_rs("Website") & " target=_blank>" & fp_rs("Website") & "</a>"

            Comment

            • JamieHowarth0
              Recognized Expert Contributor
              • May 2007
              • 537

              #7
              Hi guys,

              Jeff is absolutely right about adding http://. If you don't do it browsers get confused that you're pointing the URL to a relative location instead of an absolute URL. I found a resource on this a while ago but don't have anything to point further.

              Simply add http:// in front of your website address and it should work fine.

              Hope it helps!

              medicineworker

              Comment

              • gblack301
                New Member
                • Mar 2007
                • 17

                #8
                Originally posted by medicineworker
                Hi guys,

                Jeff is absolutely right about adding http://. If you don't do it browsers get confused that you're pointing the URL to a relative location instead of an absolute URL. I found a resource on this a while ago but don't have anything to point further.

                Simply add http:// in front of your website address and it should work fine.

                Hope it helps!

                medicineworker
                Hi guys,
                Thanks for all of your input and suggestions. It just one those things. I have actually adding the http:// in front of it and the results was the same but thanks again.

                Greg

                Comment

                • jeffstl
                  Recognized Expert Contributor
                  • Feb 2008
                  • 432

                  #9
                  Originally posted by gblack301
                  Hi guys,
                  Thanks for all of your input and suggestions. It just one those things. I have actually adding the http:// in front of it and the results was the same but thanks again.

                  Greg
                  How did you add the http in front?

                  Hopefully like this?

                  Code:
                  response.write "<a href=http://" & rs("website") & " target=_blank>" & rs("website") & "</a>"
                  Again this the above isnt working then the value of rs("website") should be double checked I would say. Also as earlier stated check your HTML source to make sure everything looks write on the output side

                  Comment

                  • jhardman
                    Recognized Expert Specialist
                    • Jan 2007
                    • 3405

                    #10
                    This seems like a pretty simple thing, but I think you may have gotten the wrong number of quote marks. For passages that should have a lot of quote marks, I prefer to write them this way:
                    Code:
                      <%
                    If Len(fp_rs("Website"))>2 then %>
                    <a target="_blank" href="<%=fp_rs("Website")%>"><%=fp_rs("Website")%></a>
                    <%
                        	End If
                    %>
                    Let me know if this helps.

                    Jared

                    Comment

                    Working...