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

Recommended Answers

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 …

Jump to Post

All 3 Replies

Member Avatar

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.

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

Member Avatar

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;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.