Advertisement
Guest User

jorgebakla

a guest
Dec 14th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1. <?php
  2. require_once 'init.php';
  3. $zxc=$_POST['zxc'];
  4. $result = $conn->prepare("Select * from question");
  5. $result-> execute();
  6. if ($zxc <=10){
  7.     for ($row=1; $row = $result->fetch(); $row++){
  8.         echo '<table>';
  9.     echo '<tr>';
  10.     echo '<td>' .$row['question']. '</td>';
  11.     echo '<div class = form-group">';
  12.     echo '<td>'.'<input type="radio">' .$row['c1']. '</td>';
  13.     echo '<td>'.'<input type="radio">' .$row['c2']. '</td>';
  14.     echo '<td>'.'<input type="radio">' .$row['c3']. '</td>';
  15.     echo '</div>';
  16.     }
  17. }
  18. else{
  19.     echo '("Daming mong tanong")';
  20. }
  21. ?>
  22.  
  23.  
  24.  
  25. <form method="POST" action="quiz.php">
  26. <h1> how many questions</h1>
  27. <input type="number" name="zxc">
  28. <input type="submit" value="go">
  29. </form>
  30.  
  31.  
  32. <?php
  33. $servername = "127.0.0.1";
  34. $username = "root";
  35. $password = "root";
  36. $database = 'exam';
  37. // Create connection
  38. $conn = mysqli_connect($servername, $username, $password, $database);
  39. // Check connection
  40. if (!$conn) {
  41.     die("Connection failed: " . mysqli_connect_error());
  42. }
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement