PHP2005 Posted September 6, 2007 Posted September 6, 2007 In have a database with checkboxes, but when display at the webpage it shows me as a list, so I am wonder how can I display them separated by comma. Here is what I have: <?php echo $recordData['color'][0]; ?> it does display as red blue white But I would like it to be showing as: red, blue, white Any help will be appreciated.
dreamingmind Posted September 6, 2007 Posted September 6, 2007 You can use the str_replace() function (http://www.php.net/manual/en/function.str-replace.php) so you could do something like: echo (str_replace($recordData['color'][0] , ", " , "r")); or $out = str_replace($recordData['color'][0] , ", " , "r"); echo ($out); The r is a return. I'm not sure what the line break character is in your case, it may be n. Regards, Don
Recommended Posts
This topic is 6357 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now