This topic is locked
[SOLVED]

 Replace commas with carriage return in text output

2/3/2021 3:07:09 PM
PHPRunner General questions
D
DealerModules authorDevClub member

Hi,

PHPR Version 10.4.

I have a text output that takes multiple entries from a drop down in the add page.
The output that I am getting looks like:

apples,bananas,oranges,pears
I would like the output to be custom and show carriage returns for each comma. It should look like:

apples

bananas

oranges

pears
I have tried str_replace but no luck.

Anyone have any direction to help me accomplish this on my view page?
Thanks

Paul

S
salus1DevClub member 2/3/2021

I think you could modify Example #6 at...
https://xlinesoft.com/phprunner/docs/view_as_settings_custom.htm
...to output the desired result.

M
macalister 2/3/2021

Hi
I think that you can use
tag in "View as" "Custom".

$value = str_replace(",","
",$value);
D
DealerModules authorDevClub member 2/3/2021

This worked well. I just need to warn user not to use the , with-in their field.
Thanks Salus1 and Macalister.