Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "./config/include.php";
- //se verifica daca sunt date trimise print post, dupa care se face insert in baza de date
- if (!empty($_POST['add_name'])){
- mysqli_query($connection, "Insert into `users` (`name`) values ('".$_POST['name']."')");
- }
- //selecteaza toate datele din tabela "users"
- $sql ="select * from users";
- $result = mysqli_query ($connection, $sql);
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
- <script>
- $(document).ready(function(){
- $(".users").click(function(){
- $("#user_devices").show();
- });
- });
- </script>
- </head>
- <body>
- <div style="width: 100%; height: 500px;">
- <div style="width: 49%; height: 400px; float: left; padding-top: 15px; margin-left: 15px;">
- <form method="POST" action="index.php">
- <label>Add New Person</label><br/>
- <input type="text" name="name"><br/>
- <input type="submit" name="add_name">
- </form>
- <ul style="list-style-type: none;">
- <?php
- if (mysqli_num_rows($result) > 0){
- while ($row = mysqli_fetch_assoc($result)){
- echo '<li>'.$row['name'].'  <button class="users" user_id="'.$row['id'].'">Check Devices</button></li><br/>';
- }
- }
- ?>
- </ul>
- </div>
- <div id="user_devices" style="width: 49%; height: 400px; float: right; padding-top: 15px;">
- <p>
- asddddddddddddddddddddddddddddddddddddddaaaaaaaaaaaaaaaassssssssssssssssssssssssss
- </p>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement