Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Writing date to a text file

New Here ,
Feb 20, 2010 Feb 20, 2010

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");

TOPICS
Server side applications

Views

227
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 20, 2010 Feb 20, 2010

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines