Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $questions = array (
- array("What is the most important part of a cooked breakfast?","Beans","Black pudding", "It's gotta be the soda bread"),
- array("How are you today?","Fine","Not too bad","I'm grand sure!"),
- array("The most important food group is","Proteins","Fats","Potatoes"),
- array("The most beautiful smell on earth is:","A wee baby's head","Your mammy's cooking","A turf fire"),
- array("Everyone is singing 'The Fields of Athenry' but you've forgotten the words. Do you:","Stop singing","Mime.","Wouldn't happen.")
- );
- //declare some variables
- $points = 0;;
- $answer1 = 0;
- function initialQuestion($questions) {
- global $questions;
- global $points;
- global $answer1;
- $r = array_rand($questions);
- echo $questions[$r][0];
- echo "<form action='' method='post'>";
- echo '<input type="submit" name="Answer1" onclick="" class="Answer" value="'.$questions[$r][1].'"><br>';
- echo '<input type="submit" name="Answer2" onclick="" class="Answer" value="'.$questions[$r][2].'"><br>';
- echo '<input type="submit" name="Answer3" onclick="" class="Answer" value="'.$questions[$r][3].'"><br>';
- echo "</form>";
- unset($questions[$r]);
- echo count($questions);
- return $questions;//return this array
- echo "<br>";
- }
- initialQuestion($questions);
- if (isset($_POST["Answer1"])){
- $points = $points + 20;
- $questions = initialQuestions($questions);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement