Guest User

index.php

a guest
Feb 2nd, 2016
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Upload</title>
  6. </head>
  7. <body>
  8.  
  9. <form class="" action="upload.php" method="post" enctype="multipart/form-data">
  10. <label for="">Name: </label><input type="text" name="name" value=""></br>
  11. <label for="">Surname: </label><input type="text" name="surname" value=""></br>
  12. <label for="">Password: </label><input type="password" name="password" value=""></br>
  13. <label for="">File: </label><input type="file" name="fileToUpload" value=""></br>
  14. <input type="submit" name="submit" value="Upload">
  15. </form>
  16.  
  17.  
  18. <?php
  19. $servername = "localhost";
  20. $username = "root";
  21. $password = "";
  22. $dbname = "task";
  23.  
  24. $conn = new mysqli($servername, $username, $password, $dbname);
  25.  
  26. $sql = "SELECT id, name,surname,password,image FROM tasks";
  27. $result = $conn->query($sql);
  28.  
  29. if ($result->num_rows > 0) {
  30. // output data of each row
  31. while($row = $result->fetch_assoc()) {
  32. echo "Id: " . $row["id"]. " - Name: " . $row["name"]. " - Surname: " . $row["surname"]. " - Password: ".$row['password']." - Our image: <img style='width:100px;height:100px;' src=uploads/".$row['image']."></br>";
  33. }
  34. } else {
  35. echo "0 results";
  36. }
  37. $conn->close();
  38. ?>
  39.  
  40.  
  41. </body>
  42. </html>
Add Comment
Please, Sign In to add comment