kalaata Posted July 1, 2021 Share Posted July 1, 2021 I have a php line like: echo "<p><b>Tags: </b>" . $row['tags'] . "</p>"; it looks like this on web page: Tags: keyword1,keyword2,keyword3,keyword4 how do i add hyperlink to each keyword like: Tags: <a href='category/keyword1'>keyword1</a>, <a href='category/keyword2'>keyword2</a>, <a href='category/keyword3'>keyword3</a>,... Quote Link to comment https://forums.phpfreaks.com/topic/313013-adding-hyperlink-to-keywords-string/ Share on other sites More sharing options...
requinix Posted July 1, 2021 Share Posted July 1, 2021 Use explode() to break the string into an array of each keyword, then use a foreach loop to output each one in turn the way you want it. 1 Quote Link to comment https://forums.phpfreaks.com/topic/313013-adding-hyperlink-to-keywords-string/#findComment-1587697 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.