Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['answer_code'])){
- echo '<script type="text/javascript">';
- echo 'swal("Success!", "Correct", "success");';
- echo 'setTimeout(function(){window.top.location="quiz"} , 2000);';
- echo '</script>';
- }
- ?>
- <?php
- $query ="SELECT * FROM quiz ORDER BY RAND() LIMIT 1";
- $result = mysqli_query($conn,$query);
- while($row = mysqli_fetch_array($result))
- {
- echo '<form action="quiz" method="post">';
- echo '<h1>"'.$row["question"].'"</h1>';
- echo '<input type="hidden" name="'.$row["question"].'">';
- echo '<input type="text" class="form-control" name="answer_code" placeholder="Type Answer" style="text-align: center" autofocus /><br>';
- echo '<input type="submit" id="btnSubmit" class="btn btn-success btn-block btn-lg" value="Submit" onclick="disableButton(this)" />';
- echo '</form>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement