Jump to content

[SOLVED] fwrite problem


will35010

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.