Jump to content

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

look here

http://www.php.net/manual/en/function.unlink.php

 

i have logged without using pword and uname LOLOLOLOL

 

in the other question use the name of chk box as array

like name='teng[]' and tell me more i dont understand the question clearly

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.