Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. class Human
  5. {
  6. public $Name;
  7. public $Surname;
  8. public $Age;
  9. public $ID;
  10.  
  11.  
  12. }?>
  13. <?php
  14. include 'functions.php';
  15. include 'database.php';
  16.  
  17. if(isset($_GET['del']))
  18. {
  19. $id = $_GET['del'];
  20. $query = "DELETE FROM `students` WHERE `students`.`id` = $id";
  21. mysqli_query($link, $query) or die (mysqli_error($link));
  22. }
  23. $matrix = get_students($link);
  24.  
  25.  
  26. ?>
  27.  
  28. <form action="" method="post" >
  29.  
  30. <?php $Data = new Human;
  31. foreach ($matrix as $UserParams):
  32. $Data->ID = $UserParams["id"]?>
  33. <?=$Data->ID ?> <?=$UserParams["first_name"]?> <?=$UserParams["middle_name"]?> <?=$UserParams["last_name"]?>
  34. <input type="checkbox" name="deleter[]" value="<?=$UserParams["id"]?>" >
  35. <td> <a href="index.php?del=<?=$UserParams["id"]?>">delete</a></td>
  36. <Br>
  37. <?php ;
  38. endforeach; ?>
  39. <input type="submit" name="formSubmit" value="Submit" >
  40. </form>
  41.  
  42. <?php
  43. if( !empty($_POST['deleter']))
  44. {
  45. $id = $_POST['deleter'];
  46. $N = count($id);
  47. }
  48. else $N = 0;
  49. echo("Вы выбрали $N : ");
  50. for($i=0; $i < $N; $i++)
  51. {
  52. echo($id[$i] . " ");
  53. }
  54. /*?del=<?=$UserParams['id']?>"*/
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement