Link to home
Start Free TrialLog in
Avatar of nicey
nicey

asked on

Writing to a File?

I'm having troubles writing to a file!  Weird.

I have this little routine going :

$dataFile = "http://mydomain.com/upgrademaillist.txt";

if(strstr($emailAddress,'@') && strstr($emailAddress,'.')) {
     $fd = fopen("$dataFile", "a");
     fwrite($fd, "$emailAddress");
     outputStatus("Sign-Up Successful...","Thank you for signing up for our upgrade newsletter.<p>You will be notified via this submitted email address as soon as we have completed the upgrade.<p>Submitted Mail Address : $emailAddress");
     fclose($fd);
} else {
     outputStatus("Sign-Up Error...","That email address does not seem to be valid.<p>Please try again...");
     exit;
}

There is various error checking before, and that all seems to be working fine.... if all the errors result in a PASS, then the above routine get's executed... I get the SUCCESS message, saying that the mail address has been recorded... but, the data file remains empty.

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Batalf
Batalf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nicey
nicey

ASKER

Of course!!!

Done it... how stupid of me in the first place. :-D

I knew a fresh face would pick out the error.

Cheers mate. ;-)