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
https://forums.phpfreaks.com/topic/176925-solved-passing-links-through-php-table/
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

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~

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.