Advertisement
Guest User

My PHP

a guest
Jun 9th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.58 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>How well do you know this Artist?</title>
  6. <link rel="stylesheet" type="text/css" href="php.css" />
  7. </head>
  8.  
  9. <body>
  10.  
  11.     <div id='body'>
  12.     <div id='pagewrap'>
  13.     <div id='wherethequestionsgo'>
  14.  
  15.    
  16.    
  17.  
  18. <?php
  19. if(@$_POST['attempted'] == 'true')
  20.  
  21. {
  22. //What is run if attempted is true
  23.  
  24. $score = 0;
  25. $totalScore = 0;
  26.  
  27.  
  28. $totalScore+=1;
  29. if(@$_POST['Q1'] == 'Reggae')
  30. {
  31. echo "";
  32. $score += 1;
  33.  
  34. }
  35.  
  36.  
  37. $totalScore+=1;
  38. if(@$_POST['Q2'] == 'TrenchTown')
  39. {
  40. echo "";
  41. $score += 1;
  42.  
  43. }
  44.  
  45. $totalScore+=1;
  46. if(@$_POST['Q3'] == '1945')
  47. {
  48. echo "";
  49. $score += 1;
  50.  
  51. }
  52.  
  53. $totalScore+=1;
  54. if(@$_POST['Q4'] == 'freedom')
  55. {
  56. echo "";
  57. $score += 1;
  58.  
  59. }
  60.  
  61. $totalScore+=1;
  62. if(@$_POST['Q5'] == '300m')
  63. {
  64. echo "";
  65. $score += 1;
  66.  
  67. }
  68.  
  69. $totalScore+=1;
  70. if(@$_POST['Q6'] == '11')
  71. {
  72. echo "";
  73. $score += 1;
  74.  
  75. }
  76.  
  77. $totalScore+=1;
  78. if(@$_POST['Q7'] == 'religion')
  79. {
  80. echo "";
  81. $score += 1;
  82.  
  83. }
  84.  
  85. $totalScore+=1;
  86. if(@$_POST['Q8'] == 'TLB')
  87. {
  88. echo "";
  89. $score += 1;
  90.  
  91. }
  92.  
  93. $totalScore+=1;
  94. if(@$_POST['Q9'] == 'NWNC')
  95. {
  96. echo "";
  97. $score += 1;
  98.  
  99. }
  100.  
  101. //
  102. $totalScore+=1;
  103. if(@$_POST['Q10'] == 'Cendella')
  104. {
  105. echo "";
  106. $score += 1;
  107.  
  108. }
  109.  
  110. $totalScore+=1;
  111. if(@$_POST['Q11'] == 'Norval')
  112. {
  113. echo "";
  114. $score += 1;
  115.  
  116. }
  117.  
  118. $totalScore+=1;
  119. if(@$_POST['Q12'] == 'PTBW')
  120. {
  121. echo "";
  122. $score += 1;
  123.  
  124. }
  125.  
  126. $totalScore+=1;
  127. if(@$_POST['Q13'] == 'OLPC')
  128. {
  129. echo "";
  130. $score += 1;
  131.  
  132. }
  133.  
  134. $totalScore+=1;
  135. if(@$_POST['Q14'] == '13')
  136. {
  137. echo "";
  138. $score += 1;
  139.  
  140. }
  141.  
  142. $totalScore+=1;
  143. if(@$_POST['Q15'] == '6')
  144. {
  145. echo "";
  146. $score += 1;
  147.  
  148. }
  149.  
  150. $totalScore+=1;
  151. if(@$_POST['Q16'] == '6')
  152. {
  153. echo "";
  154. $score += 1;
  155.  
  156. }
  157. $totalScore+=1;
  158. if(@$_POST['Q17'] == 'bob')
  159. {
  160. echo "";
  161. $score += 1;
  162.  
  163. }
  164.  
  165. $totalScore+=1;
  166. if(@$_POST['Q18'] == '17')
  167. {
  168. echo "";
  169. $score += 1;
  170.  
  171. }
  172.  
  173. $totalScore+=1;
  174. if(@$_POST['Q19'] == 'Island')
  175. {
  176. echo "";
  177. $score += 1;
  178.  
  179. }
  180.  
  181. $totalScore+=1;
  182. if(@$_POST['Q20'] == 'damian')
  183. {
  184. echo "";
  185. $score += 1;
  186.  
  187. }
  188.  
  189.  
  190. $totalScore+=1;
  191. if(@$_POST['Q21'] == 'Guava Jelly')
  192. {
  193. echo "";
  194. $score += 1;
  195.  
  196. }
  197.  
  198. $totalScore+=1;
  199. if(@$_POST['Q22'] == '1976')
  200. {
  201. echo "";
  202. $score += 1;
  203.  
  204. }
  205.  
  206. $totalScore+=1;
  207. if(@$_POST['Q23'] == 'false')
  208. {
  209. echo "";
  210. $score += 1;
  211.  
  212. }
  213.  
  214. $totalScore+=1;
  215. if(@$_POST['Q24'] == 'soccer')
  216. {
  217. echo "";
  218. $score += 1;
  219.  
  220. }
  221.  
  222. $totalScore+=1;
  223. if(@$_POST['Q25'] == '2001')
  224. {
  225. echo "";
  226. $score += 1;
  227.  
  228. }
  229.  
  230. $totalScore+=1;
  231. if(@$_POST['Q26'] == '1994')
  232. {
  233. echo "";
  234. $score += 1;
  235.  
  236. }
  237.  
  238. $totalScore+=1;
  239. if(@$_POST['Q27'] == '36')
  240. {
  241. echo "";
  242. $score += 1;
  243.  
  244. }
  245.  
  246. $totalScore+=1;
  247. if(@$_POST['Q28'] == 'Nesta Robert Marley')
  248. {
  249. echo "";
  250. $score += 1;
  251.  
  252. }
  253.  
  254. $totalScore+=1;
  255. if(@$_POST['Q29'] == 'Cancer')
  256. {
  257. echo "";
  258. $score += 1;
  259.  
  260. }
  261.  
  262. $totalScore+=1;
  263. if(@$_POST['Q30'] == 'MoneyCantBuyLove')
  264. {
  265. echo "";
  266. $score += 1;
  267.  
  268. }
  269.  
  270.  
  271.  
  272.  
  273.  
  274. echo '<h2>Congratulations <br>';
  275.  
  276. echo '<h1><b>You scored $score out of $totalScore</b> </h1>';
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284. echo '';
  285. }
  286. else
  287. {
  288. //What is run if attempted is false
  289. echo
  290.  
  291. "<form action='phpassignment.php' method='post'/>
  292. <input type='hidden' name='attempted' value='true'/>";
  293.    
  294.  
  295. $randomNumber = rand(1,3) ;
  296. switch ($randomNumber)
  297. {
  298.     case 1:echo" <h6>What kind of music did Marley create?: </h6>
  299.                 <h6><input type='radio' name='Q1' value='Pop'>Pop</h6>
  300.     <h6><input type='radio' name='Q1' value='Rock'>Rock</h6>
  301.     <h6><input type='radio' name='Q1' value='Reggae'>Reggae</h6>
  302.  <h6> <input type='radio' name='Q1' value='Rap' />Rap </h6>";
  303.     break;
  304.     case 2:echo" <h6>Where did he grow up in?:</h6>
  305.    <h6><input type='radio' name='Q2' value='Australia' />Australia</h6>    
  306.    <h6><input type='radio' name='Q2' value='England' />England</h6>
  307.    <h6><input type='radio' name='Q2' value='TrenchTown' />Trench Town</h6>
  308.    <h6><input type='radio' name='Q2' value='papuaNewGuinea' />Papua New Guinea</h6>";
  309.     break;
  310.     case 3:echo" <h6>When was he born?:</h6>
  311.    <h6><input type='radio' name='Q3' value='1975' />1975</h6>
  312.    <h6><input type='radio' name='Q3' value='1949' />1949</h6>
  313.    <h6><input type='radio' name='Q3' value='1945' />1945</h6>
  314.    <h6><input type='radio' name='Q3' value='1943' />1943</h6>";
  315.     break;    
  316.    
  317. }
  318.  
  319. $randomNumber = rand(1,3) ;
  320. switch ($randomNumber)
  321. {
  322.     case 1:echo" <h6>How did Marley Inspire Others?:</h6>
  323.    <h6><input type='radio' name='Q4' value='pot' />His love for Marijuana</h6>
  324.    <h6><input type='radio' name='Q4' value='voice' />The way he sung</h6>
  325.    <h6><input type='radio' name='Q4' value='freedom' />His strong belief in freedom</h6>
  326.    <h6><input type='radio' name='Q4' value='Clothing' />His rad style of clothing</h6>";
  327.     break;
  328.     case 2:echo" <h6>How many Albums has Bob Marley sold in his time?:</h6>
  329.    <h6><input type='radio' name='Q5' value='200k' />200,000</h6>
  330.    <h6><input type='radio' name='Q5' value='1m' />1,000,000 (1 Million)</h6>
  331.    <h6><input type='radio' name='Q5' value='20m' />25,000,000 (25 Million)</h6>
  332.    <h6><input type='radio' name='Q5' value='300m' />300,000,000 (300 Million)</h6> ";
  333.     break;
  334.     case 3:echo"  <h6>How many albums has Marley released?:</h6>
  335.    <h6><input type='radio' name='Q6' value='16' />Sixteen (16)</h6>
  336.    <h6><input type='radio' name='Q6' value='5' />Five (5)</h6>
  337.    <h6><input type='radio' name='Q6' value='3' />Three (3)</h6>
  338.    <h6><input type='radio' name='Q6' value='24' />Twenty-Four (24)</h6> ";
  339.     break;    
  340.    
  341. }
  342.  
  343. $randomNumber = rand(1,3) ;
  344. switch ($randomNumber)
  345. {
  346.     case 1:echo"<h6>Why did Bob Marley have dreadlocks?:</h6>
  347.    <h6><input type='radio' name='Q7' value='cool' />Because he wanted Swag</h6>
  348.    <h6><input type='radio' name='Q7' value='fashion' />That was the going fashion</h6>
  349.    <h6><input type='radio' name='Q7' value='religion' />His Religion</h6>
  350.    <h6><input type='radio' name='Q7' value='girls' />To get the girls</h6>";
  351.     break;
  352.     case 2:echo" <h6>'Because every little thing is going to be alright' What song is this line from?:</h6>
  353.    <h6><input type='radio' name='Q8' value='TLB' />Three Little Birds</h6>
  354.    <h6><input type='radio' name='Q8' value='DWBH' />Don't Worry Be Happy</h6>
  355.    <h6><input type='radio' name='Q8' value='BS' />Buffalo Soldier</h6>
  356.    <h6><input type='radio' name='Q8' value='RS' />Redemption Song</h6>";
  357.     break;
  358.     case 3:echo"  <h6>''And then Georgie would make the fire light, log wood burnin' through the night' What song is this from?:</h6>
  359.    <h6><input type='radio' name='Q9' value='OL' />One Love</h6>
  360.    <h6><input type='radio' name='Q9' value='DWBH' />Don't Worry Be Happy</h6>
  361.    <h6><input type='radio' name='Q9' value='NWNC' />No Woman, No Cry</h6>
  362.    <h6><input type='radio' name='Q9' value='RS' />Redemption Song</h6>";
  363.     break;    
  364.    
  365. }
  366.  
  367. $randomNumber = rand(1,3) ;
  368. switch ($randomNumber)
  369. {
  370.     case 1:echo"  <h6>What was Bob Marley's mother's name?:</h6>
  371.    <h6><input type='radio' name='Q10' value='linda' />linda</h6>
  372.    <h6><input type='radio' name='Q10' value='Cendella' />Cedella</h6>
  373.    <h6><input type='radio' name='Q10' value='Mandella' />Mandella</h6>
  374.    <h6><input type='radio' name='Q10' value='Maud' />Maud</h6>";
  375.     break;
  376.     case 2:echo" <h6>Who was Bob Marley's father?:</h6>
  377.    <h6><input type='radio' name='Q11' value='noDad' />He had no father</h6>
  378.    <h6><input type='radio' name='Q11' value='Ziggy' />Ziggy</h6>
  379.    <h6><input type='radio' name='Q11' value='damian' />damian</h6>
  380.    <h6><input type='radio' name='Q11' value='Norval' />Norval</h6> ";
  381.     break;
  382.     case 3:echo" <h6>Who was in the Wailers with Bob Marley?:</h6>
  383.    <h6><input type='radio' name='Q12' value='PTBW' />Peter Tosh and Bunny Wailer</h6>
  384.    <h6><input type='radio' name='Q12' value='BTPW' />Bunny Tosh and Peter Wailer</h6>
  385.    <h6><input type='radio' name='Q12' value='BWPW' />Bunny Wailer and Peter Wallce</h6>
  386.    <h6><input type='radio' name='Q12' value='NickiWebster' />Nicki Webster</h6>";
  387.     break;    
  388.    
  389. }
  390.  
  391. $randomNumber = rand(1,3) ;
  392. switch ($randomNumber)
  393. {
  394.     case 1:echo"  <h6>In 1978, Bob Marley performed at another political concert in Jamaica set up in an effort to calm warring parties, what was the name of the concert?:</h6>
  395.    <h6><input type='radio' name='Q13' value='420' />420 Love</h6>
  396.    <h6><input type='radio' name='Q13' value='OLPC' />One Love Peace Concert</h6>
  397.    <h6><input type='radio' name='Q13' value='ImBobMarley' />Im Bob Marley</h6>
  398.    <h6><input type='radio' name='Q13' value='Reggae' />Reggae Festival</h6>   ";
  399.     break;
  400.     case 2:echo" <h6>How many children does Bob Marley Have?: </h6>
  401.    <h6><input type='radio' name='Q14' value='13' />13</h6>
  402.    <h6><input type='radio' name='Q14' value='3' />3</h6>
  403.    <h6><input type='radio' name='Q14' value='2' />2</h6>
  404.    <h6><input type='radio' name='Q14' value='Nokids' />He didn't have Kids</h6>";
  405.     break;
  406.     case 3:echo" <h6>How many Son's Did he have?: </h6>
  407.    <h6><input type='radio' name='Q15' value='6' />6</h6>
  408.    <h6><input type='radio' name='Q15' value='3' />3</h6>
  409.    <h6><input type='radio' name='Q15' value='2' />2</h6>
  410.    <h6><input type='radio' name='Q15' value='0' />He didn't have any Sons</h6>";
  411.     break;    
  412.    
  413. }
  414. $randomNumber = rand(1,3) ;
  415. switch ($randomNumber)
  416. {
  417.     case 1:echo" <h6>How many Son's Did he have?: </h6>
  418.    <h6><input type='radio' name='Q16' value='6' />6</h6>
  419.    <h6><input type='radio' name='Q16' value='3' />3</h6>
  420.    <h6><input type='radio' name='Q16' value='2' />2</h6>
  421.    <h6><input type='radio' name='Q16' value='0' />He didn't have any Sons</h6>";
  422.     break;
  423.     case 2:echo" <div align='left'>
  424.    <h6>Which of these pictures is bob marley?: </h6>
  425.   <input type='radio' name='Q17' value='bob' /><img src='bobforq.jpg' />
  426.    <input type='radio' name='Q17' value='slowburn' /><img src='slowburnforq.jpg' /> <br />
  427.    <input type='radio' name='Q17' value='depp' /><img src='johnnyforq.jpg' />
  428.    <input type='radio' name='Q17' value='ziggy' /><img src='ziggyforq.jpg' />              
  429.    </div>";
  430.     break;
  431.     case 3:echo" <h6>How old was Marley when he cut his first record, Judge Not?: </h6>
  432.    <h6><input type='radio' name='Q18' value='10' />Ten (10)</h6>
  433.    <h6><input type='radio' name='Q18' value='27' />Twenty-Seven (27)</h6>
  434.    <h6><input type='radio' name='Q18' value='28' />Twenty-Eight (28)</h6>
  435.    <h6><input type='radio' name='Q18' value='17' />Seventeen (17)</h6>";
  436.     break;    
  437.  
  438.     }
  439.    
  440. $randomNumber = rand(1,3) ;
  441. switch ($randomNumber)
  442. {
  443.     case 1:echo" <h6><input type='radio' name='Q19' value='WoamnNoCry' />No Woman No Cry</h6>
  444.    <h6><input type='radio' name='Q19' value='Marley' />Bob Marley Records</h6>
  445.    <h6><input type='radio' name='Q19' value='Island' />Island Records</h6>
  446.    <h6><input type='radio' name='Q19' value='Wailers' />The Wailers</h6>";
  447.     break;
  448.     case 2:echo"<h6>Which of Bob Marley’s sons was nicknamed 'Jr. Gong'?:</h6>
  449.    <h6><input type='radio' name='Q20' value='ziggy' />Ziggy</h6>
  450.    <h6><input type='radio' name='Q20' value='damian' />Damian</h6>
  451.    <h6><input type='radio' name='Q20' value='Stephen' />Stephen</h6>
  452.    <h6><input type='radio' name='Q20' value='Rohan' />Rohan</h6>";
  453.     break;
  454.     case 3:echo"<h6>What Bob Marley hit was recorded by Barbara Streisand?:</h6>
  455.    <h6><input type='radio' name='Q21' value='Guava Jelly' />“Guava Jelly” </h6>
  456.    <h6><input type='radio' name='Q21' value='One Love' />One Love</h6>
  457.    <h6><input type='radio' name='Q21' value='BuffaloSoldier' />Buffalo Soldier</h6>
  458.    <h6><input type='radio' name='Q21' value='ThreeLittleBirds' />Three Little Birds</h6>";
  459.     break;    
  460.  
  461.     }  
  462.    
  463. $randomNumber = rand(1,3) ;
  464. switch ($randomNumber)
  465. {
  466.     case 1:echo" <h6>What year did some person try to murder Bob Marley?:</h6>
  467.    <h6><input type='radio' name='Q22' value='1976' />1976</h6>
  468.    <h6><input type='radio' name='Q22' value='1986' />1986</h6>
  469.    <h6><input type='radio' name='Q22' value='2013' />2013</h6>
  470.    <h6><input type='radio' name='Q22' value='2000 b.c' />2000 B.C</h6>";
  471.     break;
  472.     case 2:echo"  <h6>Bob Marley's July 4 birthday is a national holiday in Jamaica (true or false):</h6>
  473.    <h6><input type='radio' name='Q23' value='true' />True</h6>
  474.    <h6><input type='radio' name='Q23' value='false' />False</h6>";
  475.     break;
  476.     case 3:echo"  <h6>What was Bob's Favourite Sport?</h6>
  477.    <h6><input type='text' name='Q24' value='' /></h6>";
  478.     break;    
  479.  
  480.     }  
  481. $randomNumber = rand(1,3) ;
  482. switch ($randomNumber)
  483. {
  484.     case 1:echo"<h6>What year did Bob Marley receive a star on the Hollywood Walk of Fame?:</h6>
  485.    <h6><input type='radio' name='Q25' value='1999' />1999</h6>
  486.    <h6><input type='radio' name='Q25' value='2001' />2001</h6>
  487.    <h6><input type='radio' name='Q25' value='1976' />1976</h6>
  488.    <h6><input type='radio' name='Q25' value='2009' />2009</h6>";
  489.     break;
  490.     case 2:echo" <h6>What year was Bob Marley inducted into the Rock and Roll Hall of Fame?</h6>
  491.    <h6><input type='radio' name='Q26' value='1994' />19944</h6>
  492.    <h6><input type='radio' name='Q26' value='2001' />2001</h6>
  493.    <h6><input type='radio' name='Q26' value='1974' />1974</h6>
  494.    <h6><input type='radio' name='Q26' value='1956' />1956</h6>";
  495.     break;
  496.     case 3:echo" <h6>How old was Bob?</h6>
  497.    <h6><input type='text' name='Q27' value='' /></h6>";
  498.     break;    
  499.  
  500.     }  
  501. $randomNumber = rand(1,3) ;
  502. switch ($randomNumber)
  503. {
  504.     case 1:echo"<h6>What is Bob Marley's Full Name?</h6>
  505.    <h6><input type='radio' name='Q28' value='Nesta Robert Marley' />Nesta Robert Marley</h6>
  506.    <h6><input type='radio' name='Q28' value='Bob Marley' />Bob Marley</h6>
  507.    <h6><input type='radio' name='Q28' value='Robert Marley' />Robert Marley</h6>
  508.    <h6><input type='radio' name='Q28' value='Ziggy Marley' />Ziggy Marley</h6>";
  509.     break;
  510.     case 2:echo" <h6>How did Bob Marley Die?</h6>
  511.    <h6><input type='radio' name='Q29' value='DidntDie' />He's Not dead?</h6>
  512.    <h6><input type='radio' name='Q29' value='pot' />Over use of Marijuana</h6>
  513.    <h6><input type='radio' name='Q29' value='hedied' />He died?</h6>
  514.    <h6><input type='radio' name='Q29' value='Cancer' />Cancer</h6>";
  515.     break;
  516.     case 3:echo"<h6>What were Bob Marley's last words to his son Stephen?</h6>
  517.    <h6><input type='radio' name='Q30' value='420Blaze' />420 Blaze it</h6>
  518.    <h6><input type='radio' name='Q30' value='MoneyCantBuyLove' />Money Can't Buy Love</h6>
  519.    <h6><input type='radio' name='Q30' value='One Love' />One Love</h6>
  520.    <h6><input type='radio' name='Q30' value='MusicIsEverything' />Music Is Everything</h6> ";
  521.     break;    
  522.  
  523.     }
  524.    
  525.     echo "</br>
  526. </br>
  527. <input type='submit' value='How well do you know Bob?'/>
  528. </br>
  529.  
  530.  
  531.  
  532. </form>";
  533.  
  534. }
  535.  
  536.  ?>
  537.    
  538.    
  539. </body>
  540.  
  541.  
  542. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement