-3

My Problem : i cant delete the last char of a string :

  foreach($_POST['checkbox'] as $item)
{
    $string .= $item.', ';
}

$markte=rtrim($string ,", ");
Ced.Str
  • 1
  • 4

1 Answers1

1

Better use php implode function:

$string = implode(', ', $_POST['checkbox']);

http://php.net/manual/en/function.implode.php

Vladimir
  • 1,373
  • 8
  • 12