Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['answer_code'])){
  3.  
  4. echo '<script type="text/javascript">';
  5. echo 'swal("Success!", "Correct", "success");';
  6. echo 'setTimeout(function(){window.top.location="quiz"} , 2000);';
  7. echo '</script>';
  8.  
  9. }
  10.  
  11. ?>
  12.  
  13. <?php
  14.  
  15. $query ="SELECT * FROM quiz ORDER BY RAND() LIMIT 1";
  16. $result = mysqli_query($conn,$query);
  17.  
  18. while($row = mysqli_fetch_array($result))
  19. {
  20. echo '<form action="quiz" method="post">';
  21. echo '<h1>"'.$row["question"].'"</h1>';
  22. echo '<input type="hidden" name="'.$row["question"].'">';
  23. echo '<input type="text" class="form-control" name="answer_code" placeholder="Type Answer" style="text-align: center" autofocus /><br>';
  24. echo '<input type="submit" id="btnSubmit" class="btn btn-success btn-block btn-lg" value="Submit" onclick="disableButton(this)" />';
  25. echo '</form>';
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement