slapdashgrim Posted August 5, 2007 Share Posted August 5, 2007 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/ Quote Link to comment https://forums.phpfreaks.com/topic/63466-help-on-deleting-a-txt-file/ Share on other sites More sharing options...
Fadion Posted August 5, 2007 Share Posted August 5, 2007 u can use <a href="http://www.php.net/manual/en/function.unlink.php">unlink</a> Quote Link to comment https://forums.phpfreaks.com/topic/63466-help-on-deleting-a-txt-file/#findComment-316260 Share on other sites More sharing options...
teng84 Posted August 5, 2007 Share Posted August 5, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/63466-help-on-deleting-a-txt-file/#findComment-316261 Share on other sites More sharing options...
slapdashgrim Posted August 5, 2007 Author Share Posted August 5, 2007 okay now i have made it so you have to loggin right lol! thanks for tellin me! Quote Link to comment https://forums.phpfreaks.com/topic/63466-help-on-deleting-a-txt-file/#findComment-316270 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.