Advertisement
Guest User

Untitled

a guest
Jul 4th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <form method='post'>
  2. <?php
  3. $file = file('list.txt');
  4. if(!empty($_POST))
  5. {
  6.    file_put_contents('list.txt', '');
  7.    foreach($file as $key => $value) {
  8.         if(!isset($_POST['s'.$key])) {
  9.             //unset($_POST['s'],$key);
  10.             $mol = [$key => $value];
  11.             foreach($mol as $v) {
  12.                 file_put_contents('list.txt', $v, FILE_APPEND);
  13.             }
  14.         }
  15.     }
  16.     $file = file('list.txt');
  17.     foreach($file as $key => $value) {
  18.         echo "<input type='checkbox' name='s".$key."' value={$key}>{$value}<br/>";
  19.     }
  20. } else {
  21.     foreach($file as $key => $value) {
  22.         echo "<input type='checkbox' name='s".$key."' value={$key}>{$value}<br/>";
  23.     }
  24. }
  25. ?>
  26. <input type='submit' value='send'/>
  27. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement