[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Writing to a File?

Posted on 2002-07-20
2
Medium Priority
?
181 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 300 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month18 days, 15 hours left to enroll

834 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