Jump to content

Help on deleting a TXT File


slapdashgrim

Recommended Posts

i want to make my News creation system be able to delete file that holds the text for the news. Is it possible to create a script to delete a file in php? my script that fetches the news is this.

<table width="100%">
    <?php
    
      $list = getNewsList();
      foreach ($list as $value) {
        $newsData = file("news/".$value);
        $newsTitle  = $newsData[0];
         $submitDate = $newsData[1];    
         unset ($newsData['0']);
         unset ($newsData['1']);
        
         $newsContent = "";
         foreach ($newsData as $value) {
               $newsContent .= $value;
         }
        
        echo "<tr><th align='left'>$newsTitle</th><th align='right'>$submitDate</th></tr>";
        echo "<tr><td colspan='2'>".$newsContent."<br/><hr size='1'/></td></tr>";
      }
    ?>
    <a href="SDN_admin.php">Add</a>
    </table>

 

that works great. i just want to make a page that will display the same just have check boxes next to each news item so that they can select a one or more and press delete. the files are named by date and time HELP please!

to view the above script in action go to http://grimhq.com/grimspace/news_system/

Link to comment
https://forums.phpfreaks.com/topic/63466-help-on-deleting-a-txt-file/
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.