...

View Full Version : Link within an explode/implode



shanparker
03-11-2008, 07:00 PM
I have the code below pulling data from ONE field in a database that has keywords in it, separated by line breaks. Sort of silly, now I know, had I known when I built the database, what I do now I might have went about it differently. But it now, is what it is.

In any case, what I'm needing to do is link each keyword. Right now the code below divides each keyword with a comma. But I'm now also wanting to link each keyword back to the search engine, so people can search those words just by clicking on them.

I've tinkered with this code for several hours, to no avail.

Help?


<?php
function isnotempty ($var) {
return (strlen (trim ($var)) > 0);
}
$tmp = explode ("\r\n", $row['keywords']);
echo ("<p>" . implode (', ', array_filter ($tmp, "isnotempty")) . "</p>");
?>

_Aerospace_Eng_
03-11-2008, 07:54 PM
Well what link would you want them to go to? What is the format?

shanparker
03-11-2008, 07:59 PM
Well what link would you want them to go to? What is the format?

The link is


<a href="search.php?q=keyword">keyword</a>

shanparker
03-12-2008, 01:52 PM
Apparently I've stumped ya'll.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum