Advertisement
Guest User

Untitled

a guest
Feb 7th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. function initialQuestion() {
  2.  
  3. global $row;
  4.  
  5. $r = array_rand($row);
  6.  
  7. echo $row[$r][0];
  8.  
  9. echo "<form action='' method='post'>";
  10. echo '<input type="submit" name="Answer1" onclick="" class="Answer" value="'.$row[$r][1].'"><br>';
  11. echo '<input type="submit" name="Answer2" onclick="" class="Answer" value="'.$row[$r][2].'"><br>';
  12. echo '<input type="submit" name="Answer3" onclick="" class="Answer" value="'.$row[$r][3].'"><br>';
  13. echo "</form>";
  14.  
  15. unset($row[$r]);
  16.  
  17. echo count($row);
  18.  
  19. echo "<br>";
  20.  
  21. global $points;
  22. global $answer1;
  23. global $answer2;
  24. global $answer3;
  25.  
  26. if (isset($_POST["Answer1"])){
  27. echo("You pressed answer 1");
  28. $points = $points + $answer1;
  29. echo("<br> You scored $points points");
  30. initialQuestions();
  31. echo("<br> ----------------------<br>");
  32.  
  33. }
  34.  
  35. else if (isset($_POST["Answer2"])){
  36. echo("You pressed answer 2");
  37. $points = $points + $answer2;
  38. echo("<br> You scored $points points");
  39. initialQuestions();
  40. echo("<br> ----------------------<br>");
  41. }
  42.  
  43. else if (isset($_POST["Answer3"])){
  44. echo("You pressed answer 3");
  45. $points = $points + $answer3;
  46. echo("<br> You scored $points points");
  47.  
  48. echo("<br> ----------------------<br>");
  49.  
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement