will35010 Posted June 18, 2009 Share Posted June 18, 2009 It doesn't write anything to the file or display any errors. What am I doing wrong? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Unsubscribe</title> </head> <body> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p align="center">Enter Your Email Address</p> <p align="center"> <input type="text" name="email" id="email" /> </p> <p align="center"> <input type="submit" name="submit" id="submit" value="Submit" /> </p> </form> </body> </html> <?php //form to unsubscribe email and place email address, time, and date into .txt file error_reporting(ALL); ini_set("display_errors", "on"); if(isset($_POST['email'])) { } $email = $_POST['email']; $time = date("H:i:A"); $date = date("M:j:Y"); $file = fopen("unsubscribe.txt", "a+"); fwrite($file, $email .','. $date .','. $time); fclose($file); ?> Link to comment https://forums.phpfreaks.com/topic/162808-solved-fwrite-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 18, 2009 Share Posted June 18, 2009 Use - error_reporting(E_ALL); ALL does not exist, so was probably a null/zero, which turned error_reporting off. Link to comment https://forums.phpfreaks.com/topic/162808-solved-fwrite-problem/#findComment-859109 Share on other sites More sharing options...
will35010 Posted June 18, 2009 Author Share Posted June 18, 2009 Use - error_reporting(E_ALL); ALL does not exist, so was probably a null/zero, which turned error_reporting off. Thanks!!! It was a permission problem. How do you make it write to a new line in the text file each time? Link to comment https://forums.phpfreaks.com/topic/162808-solved-fwrite-problem/#findComment-859115 Share on other sites More sharing options...
PFMaBiSmAd Posted June 18, 2009 Share Posted June 18, 2009 By writing a new-line character at the end of each line. Link to comment https://forums.phpfreaks.com/topic/162808-solved-fwrite-problem/#findComment-859178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.