Problems directing links!!

Discussion in 'PHP' started by ausgezeichnete, Dec 14, 2007.

  1. #1
    My problem is i have inserted sites name in mysql
    for example:www.google.com
    and now when i click it on my display page it gave me that
    The requested URL /template/resources/www.allwebco.com was not found on this server.
    HTML:
    what i suppose to do to make the links go to the desired page without having this
    /template/resources/
    HTML:
    and this is my code
    
     <?php do { ?>
    <SPAN class=subtitle>
    <a href="<?php echo $row_links['links']; ?>"><?php echo $row_links['resource_links_header']; ?></a></SPAN><BR />
    <?php echo $row_links['resource_links_body']; ?><BR /><BR /><BR />
      <?php } while ($row_links = mysql_fetch_assoc($links)); ?>
    
    PHP:

     
    ausgezeichnete, Dec 14, 2007 IP
  2. legend2

    legend2 Well-Known Member

    Messages:
    1,537
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    115
    #2
    add an http:// before the url (if there isn't one) before redirecting

    ex:

    <?php echo $row_links['links']; ?>
    PHP:
    becomes

    
    <?php $tmp = $row_links['links']; if(!strpos($tmp,"http://")) $tmp = "http://".$tmp; echo $tmp; ?>
    
    PHP:
     
    legend2, Dec 14, 2007 IP
  3. ausgezeichnete

    ausgezeichnete Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thnxxxxxxxx it worked
     
    ausgezeichnete, Dec 14, 2007 IP