im trying to make a function that saves my configuration data for an automatic email.
the data is coming from textareas so $_POST and put into this function.
My saving function is not saving the caracteres so no line breaks. so when i send a email the full message in 1 big string with no line breaks...
if i open the file it is saved with spaces instead of it all being on 1 line.
if ($_POST['gdwemail_obj']!="") { $gdwEConfig['gdwemail_obj'] = $_POST['gdwemail_obj']; }
if ($_POST['gdwemail_mes']!="") { $gdwEConfig['gdwemail_mes'] = $_POST['gdwemail_mes']; }
saveEConfig($gdwEConfig);
function saveEConfig($post) {
$gdw_conffile = 'components'.DS.'com_gdwformulaire'.DS.'included'.DS.'econfig.gdw.php';
$gdw_confopen = fopen($gdw_conffile,'w+');
$gdw_cfgput = '<?php';
$gdw_cfgput .= ' $gdwEconf = array(); ';
$gdw_cfgput .= ' $gdwEconf[\'gdwemail\'] = "'.$post['gdwemail'].'"; ';
$gdw_cfgput .= ' $gdwEconf[\'gdwemail_obj\'] = "'.$post['gdwemail_obj'].'"; ';
$gdw_cfgput .= ' $gdwEconf[\'gdwemail_mes\'] = "'.$post['gdwemail_mes'].'"; ';
$gdw_cfgput .= '?>';
if (!fwrite($gdw_confopen, $gdw_cfgput)) {
echo "<script> alert('ERROR: Can't save configuration file, please verify CHMOD access on \'administrator/components/com_ai/\' for write access.'); window.history.go(-1); </script>
";
exit;
}
fclose($gdw_confopen);
}
the output looks like this:
<?php $gdwEconf = array(); $gdwEconf['gdwemail'] = "j.robidas@geantduweb.ca"; $gdwEconf['gdwemail_obj'] = "Réservation pour le cours {courschoisi} a été reçus"; $gdwEconf['gdwemail_mes'] = "Cher {nomdemandeur},
Votre demande de réservation a été reçus avec succès.
Information pour votre sélection:
{courschoisi}
{dateheurechoisi}
Merci
L'équipe de Belle vie de chien"; ?>