delete lines in file checkboxes


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #Datenverarbeitung
  2. if (isset($HTTP_POST_VARS['delete'])) {
  3. $inhalt = file('_matrix2.php');
  4. $fp = fopen('_matrix2.php','w');
  5. flock($fp,2);
  6. while (list($inhalt_key,$inhalt_val) = each($inhalt)) {
  7. if (!isset($HTTP_POST_VARS['delete'.$inhalt_key])) {
  8. fwrite($fp,$inhalt_val);
  9. }
  10. }
  11. flock($fp,3);
  12. fclose($fp);
  13. }
  14. #ENDE: Datenverarbeitung
  15.  
  16. #Datenausgabe
  17. $inhalt = file('_matrix2.php');
  18.  
  19. echo '<form method="post" action="'.$HTTP_SERVER_VARS['PHP_SELF'].'">';
  20. while (list($inhalt_key,$inhalt_val) = each($inhalt)) {
  21. echo $inhalt_val.'<input type="checkbox" name="delete'.$inhalt_key.'"><br>';
  22. }
  23. echo '<input type="submit" name="delete"></form>';
  24. #ENDE: Datenausgabe

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.