removing a blank line in txt file with php
Hi,
I made this super simple (learning) php script to subscribe to an e-mail list, send the mails with a webbased textfield and that works all ok. The problem is unsubscribing.
In the mail is a link like this: http://wwww.somhost.com/[email protected]
I made a form where the initial value is that email, when they press the submit button it posts it to this script:
(Ihave 1 e-mail per line)
PHP Code:
$T1 = $_POST['T1'];
$splitmails = file("themails.dat");
$tn = 0;
for ($i = 0; $i < count($splitmails); $i++) {
$deleteadres = $splitmails[$tn];
$tn++;
$deleteadres = str_replace("$T1", "", $deleteadres);
$fp .= $deleteadres;
}
$a = fopen("themails.dat", "w");
fputs($a, "$fp");
fclose($a);
?>
This leaves a blank line where the unsubscribed e-mail was. Is there any way to remove that blank line too?
Thanks :)