如何使用发布到数据库的其他字符替换输入框中的逗号?

I have an input box which will have data separated by commas. I want to post to the database these to be replaced with an alternate value. How could this be done? I am still new to PHP so I would appreciate if you could make it as simple as possible.

If you are receiving your value from $_POST['someValue'], you can do this:

$newValue = str_replace(',','any-separater',$_POST['someValue']);

Normally, with comma-separated data, you probably want to extract the values from the string. This will create an array of values from the string.

$comma_separated_list = 'foo, bar, baz';
$values = array_map('trim', explode(',', $comma_separated_list));

// Now:
// $values = array('foo', 'bar', 'baz');
foreach ($values as $value) {
  print $value;
}

prints:

foo

bar

baz

As for inserting this data into the database, we'd need to see a database schema to get a better idea of how the data is stored.