SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member talktechno's Avatar
    Join Date
    Apr 2006
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    printing variable as hyperlink

    one of the fields on mydatabase stores a weburl

    but when i print it, it does not appear as a hyperlink

    i have tried to print the variable using this

    PHP Code:
    "<a href=>$linkfield</a>" 
    it is retrieved as part of a search and should take me to the link page, but the link when clicked on keeps me on the search reult page, it seems to store the search hyperlink instead of the one i am trying to print from the database


  2. #2
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You store the url in your database, not a hyperlink, plain text.

    Then, when you fetch data from from the db, print this using

    PHP Code:
    print "<a href=".$linkfield.">".$linkfield."</a>"

  3. #3
    SitePoint Member talktechno's Avatar
    Join Date
    Apr 2006
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kigoobe View Post
    You store the url in your database, not a hyperlink, plain text.

    Then, when you fetch data from from the db, print this using

    PHP Code:
    print "<a href=".$linkfield.">".$linkfield."</a>"
    that worked thanks

  4. #4
    SitePoint Addict khuramyz's Avatar
    Join Date
    Oct 2005
    Location
    Manchester, UK
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you should try
    echo "<a href=\"".$linkfield."\">".$linkfield."</a>";
    as the href should be between double quotes.

  5. #5
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    khuramyz is right talktechno. Sorry for overlooking this.


Bookmarks

Posting Permissions

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