Link to home
Start Free TrialLog in
Avatar of jblayney
jblayneyFlag 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

ASKER CERTIFIED SOLUTION
Avatar of haloexpertsexchange
haloexpertsexchange
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
woops on line 5 it should be $link = "<a href='blog_feed.php?tag=$tag'>$tag</a>";
Avatar of jblayney

ASKER

thank you