Advertisement
Guest User

Untitled

a guest
May 15th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <?php
  6. $servername = "localhost";
  7. $username = "root";
  8. $password = "";
  9. $dbname = "klevis";
  10.  
  11. // Create connection
  12. $conn = new mysqli($servername, $username, $password, $dbname);
  13. // Check connection
  14. if ($conn->connect_error) {
  15. die("Connection failed: " . $conn->connect_error);
  16. }
  17.  
  18. $sql = "SELECT email FROM emails";
  19. $result = $conn->query($sql);
  20.  
  21. if ($result->num_rows > 0) {
  22. // output data of each row
  23. ?>
  24.  
  25. <form method="get" action="page2.php">
  26. <?php
  27. while($row = $result->fetch_assoc()) {
  28.  
  29. echo $row["email"]; ?> <input type="hidden" name="email" value="<?php echo $row["email"]; ?>">
  30. &nbsp;&nbsp;
  31. Gender:
  32. <input type="radio" name="<?php echo $row["email"]; ?>" value="0">Absent
  33. <input type="radio" name="<?php echo $row["email"]; ?>" value="1">Present
  34.  
  35. <br>
  36.  
  37. <?php
  38.  
  39. }
  40. ?>
  41. <br>
  42. <input type="submit" value="submit" >
  43. </form>
  44. <?php
  45. } else {
  46. echo "0 results";
  47. }
  48.  
  49. $conn->close();
  50. ?>
  51.  
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement