I'm trying to write to a file and it's working except there are no
line breaks everything is on the same line!!!
!!!!!!!!CAN SOME ONE PLEASE HELP ME!!!!!!!!!
Here is the Code:
$content = "";
$content.= "AmeriPlan Sign-up Request\n\n";
$content.= "$first_name $middle_initial $last_name, has requested to be\n";
$content.= "Enrolled in the Dental Care Program.\n\n";
$content.= "$first_name $middle_initial $last_name\n";
$content.= "Address: $mail_address ";
if ($apt_num) {
$content.="$apt_num";
}
$content.= "\n";
$content.= "$city, $state $zip_1-$zip_2\n\n";
$content.= "D.O.B.: $dob_mm/$dob_dd/$dob_yyyy\n";
$content.= "Social Security #: $social_1-$social_2-$social_3\n";
$content.= "Sex: ";
if($sex_m) { $content.="Male"; } else { $content.="Female"; }
$content.= "\n";
$content.= "Telephone #: ($tel_1) $tel_2-$tel_3\n";
$content.= "E-Mail: $email\n\n";
$content.= "Applicant's Employer: $app_employ\n\n";
$content.= "I want my materials in:\n";
$content.= "English: ";
if($mat_english) { $content.="Yes\n"; } else { $content.="No\n"; }
$content.= "Spanish: ";
if($mat_spanish) { $content.="Yes\n"; } else { $content.="No\n"; }
$content.= "\n\n";
if ($fam_member_first || $fam_member_first2 || $fam_member_first3 ||
$fam_member_first4 || $fam_member_first5) {
$content.="Household Members\n\n";
if($fam_member_first) {
$content.="$fam_member_first $fam_member_last ($fam_member_dob)\n";
}
if($fam_member_first2) {
$content.="$fam_member_first2 $fam_member_last2 ($fam_member_dob2)\n";
}
if($fam_member_first3) {
$content.="$fam_member_first3 $fam_member_last3 ($fam_member_dob3)\n";
}
if($fam_member_first4) {
$content.="$fam_member_first4 $fam_member_last4 ($fam_member_dob4)\n";
}
if($fam_member_first5) {
$content.="$fam_member_first5 $fam_member_last5 ($fam_member_dob5)\n";
}
}
$content.="\n\n";
if ($ref_name || $ref_name2 || $ref_name3 || $ref_name4 || $ref_name5) {
$content.="Referrals:\n\n";
if ($ref_name) {
$content.="$ref_name ($ref_num_one) $ref_num_two\n";
}
if ($ref_name2) {
$content.="$ref_name2 ($ref_num_one2) $ref_num_two2\n";
}
if ($ref_name3) {
$content.="$ref_name3 ($ref_num_one3) $ref_num_two3\n";
}
if ($ref_name4) {
$content.="$ref_name4 ($ref_num_one4) $ref_num_two4\n";
}
if ($ref_name5) {
$content.="$ref_name5 ($ref_num_one5) $ref_num_two5\n";
}
}
$content.="\n\n";
$file_arch = "/home/whutch/public_html/appz/_logs/_signups/" . $first_name . " " . $last_name . ".lds";
$signup = fopen($file_arch, 'w+') or die("Could not create file:\n $file_arch");
fputs($signup, "$content")
fclose($signup);
I'm using "\n" but everything is on the same line!!!
Write to File With Line breaks?
Moderator: General Moderators
- devork
- Forum Contributor
- Posts: 213
- Joined: Fri Aug 08, 2003 6:44 am
- Location: p(h) developer's network
have you tried it with
i think it will work
Code: Select all
<?php
fwrite($fp,$msg,strlen($msg));
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
after i saw that you use \n i started thinking the same as twig.
if you've ever moved between posix and winblows you'd see artifacts of the difference in line termination in the files (ie: ^M)
while, in my experience, posix is nice enough to realize what's going on and compensate, windoze isn't. posix is also nicely equiped with unix2dos, dos2unix and unix2mac (for pre-osx macs)
this is why knowing what type of server it will deploy on is something a developer needs to take as his or her own responsibility.
i know i develop for posix when doing things for me, but that's because i personally prefer the stability (after working net ops/sys admin i've seen that even the best m$ os NEEDS downtime. i've never seen them last longer than a week without issues... on the other hand, posix only needs downtime if there's something majorly wrong that the sys admin did (no wonder why the guy got fired, screwing up compiling like that....sorry... thinking fo something that happened... two unix machines were having an issue and needed a restart every 24 hours and one of the other sys ads looked at the kernel code and realized the kernel had been screwed with, so even though peoplesoft had major issues it wasn't the cause of the restarts issue being an fte, i was taken aside and told "let this be a lesson to you; posix, no matter how bad the programs running on it, will never NEED to be restarted, windows will always need scheduled down time, this is because it's the only operating system that has signifigant memory leaks.")
if you've ever moved between posix and winblows you'd see artifacts of the difference in line termination in the files (ie: ^M)
while, in my experience, posix is nice enough to realize what's going on and compensate, windoze isn't. posix is also nicely equiped with unix2dos, dos2unix and unix2mac (for pre-osx macs)
this is why knowing what type of server it will deploy on is something a developer needs to take as his or her own responsibility.
i know i develop for posix when doing things for me, but that's because i personally prefer the stability (after working net ops/sys admin i've seen that even the best m$ os NEEDS downtime. i've never seen them last longer than a week without issues... on the other hand, posix only needs downtime if there's something majorly wrong that the sys admin did (no wonder why the guy got fired, screwing up compiling like that....sorry... thinking fo something that happened... two unix machines were having an issue and needed a restart every 24 hours and one of the other sys ads looked at the kernel code and realized the kernel had been screwed with, so even though peoplesoft had major issues it wasn't the cause of the restarts issue being an fte, i was taken aside and told "let this be a lesson to you; posix, no matter how bad the programs running on it, will never NEED to be restarted, windows will always need scheduled down time, this is because it's the only operating system that has signifigant memory leaks.")