Jump to content

Saving a blank line....!


webiter1

Recommended Posts

Not sure if the image is attaching so I will give this http://www.postbox.webitry.net/ to the test position and go to >Edit/Delete E-mails from a List > Edit Selected List to view gap at top of list.

 

I am saving submitted emails to a list as in a flatfile. As an email is saved there is also a blank line being saved as in the image attached.

Why is this happening? The php code is below.

 

 //WRITE VALIDATED EMAIL TO LIST
$List = $_POST['List'];
    if (file_exists("data/$List")) { 
        $myfile = file("data/$List"); 
        $fh = fopen("data/$List", "w"); 
        for ($index = 0; $index < count($myfile); $index++) { 
            if ($Email != rtrim($myfile[$index])) { 
                fputs($fh, $myfile[$index]); 
            } 
        } 
        fputs($fh, $Email . "\n"); 
        fclose($fh); 
    } else { 
        $myfile = fopen("data/$List", "w"); 
        fputs($myfile, $Email . "\n"); 
        fclose($myfile); 
    }

 

Not sure if the image is attaching so I will give this http://www.postbox.webitry.net/ to the test position and go to >Edit/Delete E-mails from a List > Edit Selected List to view gap at top of list.

post-130821-13482403162418_thumb.jpg

Link to comment
https://forums.phpfreaks.com/topic/254755-saving-a-blank-line/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.