Avatar of jblayney
jblayney
Flag for Canada asked on

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

PHP

Avatar of undefined
Last Comment
jblayney

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
haloexpertsexchange

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
haloexpertsexchange

woops on line 5 it should be $link = "<a href='blog_feed.php?tag=$tag'>$tag</a>";
jblayney

ASKER
thank you
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23