remove array text from print_r and add some html...

Hello,

I have a text field in my database, it i used for meta tags, the user enters them into the system as so...
learning,  training, accessibility

so i want to extract the items between the commas and display as text AND wrap some HTML around it...

I have no idea how to do this and spent the last hour reading  php.net with no luck.. this is my code so far

 
So far I have come up with this...

$str = $row_Recordset_getevent['blog_meta_tags'];

print_r(explode(',', $str, -1));

which will output...

Array ( [0] => learning [1] => training [2] => accessibility ) 

What I want it to output is...

<a href="blog_feed.php?tag=learning">learning</a>, <a href="blog_feed.php?tag=training">training</a>,<a href="blog_feed.php?tag=accessibility">accessibility</a>

And even better, if I could get inside the out put and add some PHP functions, that would be great...

Open in new window

LVL 1
jblayneyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

haloexpertsexchangeCommented:
the simple way of doing this would be to do this
$tags=explode(',', $str, -1);
$output = array();
foreach($tags as $tag)
{
$link = "a href='blog_feed.php?tag=$tag'>$tag</a>";
$output[] = $link;
}
$newstr = implode(",", $output); 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
haloexpertsexchangeCommented:
woops on line 5 it should be $link = "<a href='blog_feed.php?tag=$tag'>$tag</a>";
0
jblayneyAuthor Commented:
thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.