fwrite not putting \r\n in my file (for the data provided in textareas comin from a post)
<p>im trying to make a function that saves my configuration data for an automatic email.</p>

<p>the data is coming from textareas so $_POST and put into this function.</p>

<p>My saving function is not saving the \r\n caracteres so no line breaks. so when i send a email the full message in 1 big string with no line breaks...</p>

<p>if i open the file it is saved with spaces instead of it all being on 1 line.</p>

<pre><code>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  = '&lt;?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 .= '?&gt;';
    if (!fwrite($gdw_confopen, $gdw_cfgput)) {
        echo "&lt;script&gt; alert('ERROR: Can't save configuration file, please verify CHMOD access on \'administrator/components/com_ai/\' for write access.'); window.history.go(-1); &lt;/script&gt;\n";
        exit;
    }    
    fclose($gdw_confopen);
}
</code></pre>

<p>the output looks like this:</p>

<pre><code>    &lt;?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"; ?&gt;
</code></pre>
