Jump to content

[SOLVED] Passing links through php table


twittoris

Recommended Posts

I have a script which reads a .txt file formatted URL|Description

it then loops the entries into a table.

However, the URL is not a clickable link.

How do I include an ahref in the loop?

 

while (!feof($fp)) {

$line = fgets($fp,1024); //use 2048 if very long lines

$row++;

list ($website, $description)= split ("\|", $line);

 

$col[$row] = array($row, $website, $description, $adsense);

 

Help??

Link to comment
Share on other sites

while (!feof($fp)) {

  $line = fgets($fp,1024); //use 2048 if very long lines

  $row++;

  list ($website, $description)= split ("\|", $line);

  echo "<a href=\"" . $website . "\">" . $website . "</a><br/>";

  echo $description;

}

Link to comment
Share on other sites

close....

while (!feof($fp)) {

$line = fgets($fp,1024); //use 2048 if very long lines

$row++;

list ($website, $description)= split ("\|", $line);

$website= "<a href=\"" . $website . "\">" . $website . "</a><br/>";

  $col[$row] = array($row, $website, $description, $adsense);

 

the webpage column is now a clickable hyperlink. However, the url is http://mysite.com/www.$website.com

i.e. www.mysite.com/www.yahoo.com which does not go to the right webpage

Link to comment
Share on other sites

while (!feof($fp)) {
   $line = fgets($fp,1024); //use 2048 if very long lines
   $row++;
   list ($website, $description)= split ("\|", $line);
$Http = substr($website, 0,7);
if ($Http=="http://") {
   echo <a href=\"".$website. "\">" . $website . "</a><br/>";
} else {
   echo <a href=\"http://".$website. "\">" . $website . "</a><br/>";
}
$col[$row] = array($row, $website, $description, $adsense);

Might do the trick, I think :)

 

~Glenugie~

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.