Well this is part of your code
function save_form($vars)\{\
global $database_file, $database_fields;\
$f = fopen($database_file, 'a');\
if (!$f)\{\
die("Cannot open db file for save");\
\}\
foreach ($vars as $k=>$v) \{\
$vars[$k] = str_replace(array("|", "\\r","\\n"), array('_',' ',' '), $v);\
\}\
if (is_array($database_fields)) \{\
$vars_orig = $vars; \
$vars = array();\
foreach ($database_fields as $k)\
$vars[$k] = $vars_orig[$k];\
\}\
$str = join('|', $vars);\
fwrite($f, $str."\\n");\
fclose($f);\
\}\
And it is the $str = join('|', $vars);\ that is inserting the | .
Change it to $str = join(',', $vars);\ and you should be in business.
Horrible piece of coding by the way.