0

Hi

<form action="check.php" method="POST">
<input type="text" name="keywords" /><br />
<input type="submit" value="Save The Keywords" />
</form>

I need the keywords to be links for example :
when the member put : php,mysql
it should turn like this in the database :

<a href="#">php</a>
<a href="#">mysql</a>

so when I query the key words it appear as links

2
Contributors
3
Replies
10
Views
3 Years
Discussion Span
Last Post by diafol
0

Don't place all the added html into the DB, just store the text, as is - or split the words and keep those in a separate table asnd create a link table for articles_keywords (e.g.). Use php functions to build the links in the html. That way you can build a tag cloud and search for keywords. Storing html in DBs is bad as you masy wish to change the link html at some point, e.g. add or remove a class - imagine the work required to change all those store links - urgh.

Edited by diafol

0

Ok but how can I make every word between the (,) become a link ?

0

When you retrieve a set of links from the DB...

$tagArray = array();
while($tags = ...){
    $tagArray[] = "<a href='search.php?tag={$tags['tag']}'>{$tags['tag']}</a>";
}

$tagOutput = implode(", ", $tagArray);

echo $tagOutput;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.