problems writing to file (not naming the file correctly)
Posted: Sun Mar 21, 2004 12:06 pm
This code doesn't seem to be working, it writes to the file but doesn't name the file as speified by the user from $save, it names the fill as a blank, but it works if I put time() in its place:
below is the code for the reference:
Anyone who can help I would be very greatful
Code: Select all
if($save){
writetofile("$editing\n");
print("<TR><TD colspan=5><CENTER>file created/updated");
}
function writetofile($editing){
$TheFile = "form_data/$save.txt";
$Open = fopen ($TheFile,"w");
if($Open){
fwrite ($Open,"$editing\n");
fclose($Open);
$Worked=True;
} else {
$Worked = False;
}
return $Worked;
}Code: Select all
<TR><TD colspan=5>Save As:<input type=text name="save" size=20>