Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'init.php';
- $zxc=$_POST['zxc'];
- $result = $conn->prepare("Select * from question");
- $result-> execute();
- if ($zxc <=10){
- for ($row=1; $row = $result->fetch(); $row++){
- echo '<table>';
- echo '<tr>';
- echo '<td>' .$row['question']. '</td>';
- echo '<div class = form-group">';
- echo '<td>'.'<input type="radio">' .$row['c1']. '</td>';
- echo '<td>'.'<input type="radio">' .$row['c2']. '</td>';
- echo '<td>'.'<input type="radio">' .$row['c3']. '</td>';
- echo '</div>';
- }
- }
- else{
- echo '("Daming mong tanong")';
- }
- ?>
- <form method="POST" action="quiz.php">
- <h1> how many questions</h1>
- <input type="number" name="zxc">
- <input type="submit" value="go">
- </form>
- <?php
- $servername = "127.0.0.1";
- $username = "root";
- $password = "root";
- $database = 'exam';
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $database);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement