Log function Not working.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
boomjigger
Forum Newbie
Posts: 1
Joined: Tue Mar 09, 2010 7:02 am

Log function Not working.

Post by boomjigger »

Hey guys, I have recently created a website and I need your help.

I have a part on the website where a user enters their email. I am trying to make it log the email onto a text file, but for some reason it is not logging at all. I have tried many different PHP codes, and they all do not work.

My HTML action is being directed at the php file, I don't know what the problem is, and It's pretty annoying.

Here is an example of the code I am using :

Code: Select all

function doLog($text)
{
$filename = "smileback.txt";
$fh = fopen($filename, "a") or die("Could not open log file.");
fwrite($fh, date("d-m-Y, H:i")." - $text\n") or die("Could not write file!");
fclose($fh);
}
Can anyone help me?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Log function Not working.

Post by VladSun »

Does it create the smileback.txt file? If not, it's probably a permission issue.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply