Advertisement
adrianmihaipaun

Untitled

Feb 13th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <?php
  2. include "./config/include.php";
  3.  
  4. //se verifica daca sunt date trimise print post, dupa care se face insert in baza de date
  5. if (!empty($_POST['add_name'])){
  6. mysqli_query($connection, "Insert into `users` (`name`) values ('".$_POST['name']."')");
  7. }
  8.  
  9. //selecteaza toate datele din tabela "users"
  10. $sql ="select * from users";
  11. $result = mysqli_query ($connection, $sql);
  12.  
  13. ?>
  14. <!DOCTYPE html>
  15. <html>
  16. <head>
  17. <title></title>
  18. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  19. <script>
  20. $(document).ready(function(){
  21. $(".users").click(function(){
  22. $("#user_devices").show();
  23. });
  24. });
  25. </script>
  26. </head>
  27. <body>
  28. <div style="width: 100%; height: 500px;">
  29. <div style="width: 49%; height: 400px; float: left; padding-top: 15px; margin-left: 15px;">
  30. <form method="POST" action="index.php">
  31. <label>Add New Person</label><br/>
  32. <input type="text" name="name"><br/>
  33. <input type="submit" name="add_name">
  34. </form>
  35. <ul style="list-style-type: none;">
  36. <?php
  37. if (mysqli_num_rows($result) > 0){
  38. while ($row = mysqli_fetch_assoc($result)){
  39. echo '<li>'.$row['name'].'&nbsp <button class="users" user_id="'.$row['id'].'">Check Devices</button></li><br/>';
  40. }
  41. }
  42. ?>
  43. </ul>
  44. </div>
  45. <div id="user_devices" style="width: 49%; height: 400px; float: right; padding-top: 15px;">
  46.  
  47. <p>
  48. asddddddddddddddddddddddddddddddddddddddaaaaaaaaaaaaaaaassssssssssssssssssssssssss
  49. </p>
  50.  
  51. </div>
  52. </div>
  53.  
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement