Copy link to clipboard
Copied
So I have a very basic php form which writes whatever is written to a text file, which then displays in table on my web page. I'm trying to extend little script by being able to delete the .txt file from the web page - this I can do, but only for text files with static names.
The nature of the form requires writing to a text file with a unique name so the date is included in the .txt filename (using $filename = date('YmdHi'); $f = fopen('events/'.$filename."events.txt","w+");)
Now, I've tried as much as I can think of but I can't get the date (in the form YmdHi) to be written to the same text file as the form (or at all, for that matter). Best I've managed is getting it to write the name of an assigned function for it...
Does anyone know how this can be done?
Thanks
Jordan
I apologies if this post is a little confusing but I only started trying to understand php script yesterday so I'm complete newbie.
Also:
Write command I've been using look along the lines of:
$newsTitle = isset($_POST['name']) ? $_POST['name'] : 'Untitled';
fwrite($f,$newsTitle."\n");
Copy link to clipboard
Copied
Oh yes, I also want the delete function to be generated alongside the form entry on my page automatically. I think this is inferred in ^ but I thought I'd make sure.
But I think I can find a way to do this so long as there's a way to write the date.