I have this code so far that i've been struggling to finally perfect. However, I need to get all the data on multiple lines. Right now everything is printed on 1 line in my html file. How can I add carriage returns or whatever in PHP to get this data on multiple lines (i.e):
test1
test2
test3
etc
<?
include("conf.php");
$textarea[1] = "$sent1";
$textarea[2] = "$sent2";
$textarea[3] = "$sent3";
$textarea[4] = "$sent4";
$textarea[5] = "$sent5";
$textarea[6] = "$sent6";
$textarea[7] = "$sent7";
$counttextareas = count($textarea);
$array = array();
FOR($i = 1; $i <= $counttextareas; $i++) {
array_push($array, $textarea[$i]);
$today = date("M-d-Y");
$filename = $today.".html";
$somecontent = $textarea[$i];
foreach ($somecontent as $key => $textarea[$i]) {
$somecontent[$key] = trim($textarea[$i]);
$somecontent[$key] .= "\n"; }
// Let's make sure the file exists and is writable first.
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)<br><br>";
fclose($handle);
}
?>