Advertisement
Guest User

Untitled

a guest
Nov 10th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <html>
  2. <body>
  3. <form name="empInfo" method="post" enctype="multipart/form-data" align="center" action="">
  4.  
  5. Host Employee ID: <input type="text" name="id"><br>
  6. <input type="submit" value="Click here to fill host info" name="submit"><br>
  7.  
  8. </form>
  9.  
  10. <?php
  11. if(isset($_POST["submit"])) {
  12. $id= $_POST['id'];
  13.  
  14. $servername = "localhost";
  15. $username = "root";
  16. $password = "";
  17. $dbname = "test";
  18.  
  19. // Create connection
  20. $conn = new mysqli($servername, $username, $password, $dbname);
  21. // Check connection
  22. if ($conn->connect_error) {
  23. die("Connection failed: " . $conn->connect_error);
  24. }
  25. $sql="SELECT * FROM `users` WHERE `ID`= '$id'";
  26. $result=mysqli_query($conn,$sql);
  27. $row= mysqli_fetch_assoc($result);
  28.  
  29. echo $row['ID'];
  30. }
  31. ?>
  32. </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement