Okay, here’s what I’ve got. I’m only trying to write a header on my text file if it’s the first time that it’s been opened. This will be opened in excel so I’m wanting to use that line to name the fields. I’m trying this but it coninues to write the header each time something is entered. Anyone have any idea?
[code=php]
$fulldate = $_POST[‘fulldate’];
$writeheader=”Escalated Issue,Order Number,Sent By
“;
$writedata = “$escalation,$order-$line,$emailaddress
“;
$headertest=”1”;
if(!is_writable(“testfile$fulldate.txt”))
{
$headertest=”2″;
}
$handle = fopen(“testfile$fulldate.txt”, “a”);
if($headertest=”2″)
{
fwrite($handle, $writeheader);
}
fwrite($handle, $writedata);
fclose($handle);
I’ve also tried this to no avail:
[code=php]
$textfilename=”test$fulldate.txt”;
if(!file_exists($textfilename))
{
$headertest=”2″;
}
$handle = fopen($textfilename, “a”);
if($headertest=”2″)
{
fwrite($handle, $writeheader);
$headertest=”0″;
}
fwrite($handle, $writedata);
fclose($handle);