Solved

Writing to a File?

Posted on 2002-07-20
2
170 Views
Last Modified: 2006-11-17
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?
0
Comment
Question by:nicey
2 Comments
 
LVL 32

Accepted Solution

by:
Batalf earned 75 total points
ID: 7167258
Maybe you could try to change the link to your file.

Instead of

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

try:

$dataFile = "upgrademaillist.txt"; or the relative path to the file.

Batalf
0
 
LVL 1

Author Comment

by:nicey
ID: 7167270
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. ;-)
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question