Jump to content

thephoneguy

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

thephoneguy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. <?php function DisplayQuizResults() { // Determine That The User Has Come To This Page From // A Proper Quiz Page if( !isset( $_POST[ 'submit' ] ) ) { // Invalid Access die( "Sorry, direct access to this file is not permitted.\n" ); } // Obtain Username if( isset( $_POST[ 'name' ] ) && $_POST[ 'name' ] != "" ) { $name = $_POST[ 'name' ]; } else { die( "You forgot to fill in your name.\n" ); } // Obtain Quiz Answers $q = array(); for( $x = 1; $x<20; $x++ ) { if( isset( $_POST[ 'Q'.$x ] ) ) { $q[$x] = $_POST[ 'Q'.$x ]; } else { die( "You forgot to fill in answer: ". $x . "\n" ); } } // Display Results echo( "<p>Hello: " . $name . "<br><br><br>\n" ); if( ($q[$x=1] + $q[$x]<21) >= 0 && ($q[$x=1] + $q[$x]<21) <= 20 ); { echo ('im a little teapot'."<br><br><br><br><br>"); } if( ($q[$x=1] + $q[$x]<21) >= 21 && ($q[$x=1] + $q[$x]<21) <= 40 ); { echo ('im a medium teapot'."<br><br><br><br><br>"); } if( ($q[$x=1] + $q[$x]<21) >= 41 && ($q[$x=1] + $q[$x]<21) <= 60 ); { echo ('im a large teapot'."<br><br><br><br><br>"); } if( ($q[$x=1] + $q[$x]<21) >= 61 && ($q[$x=1] + $q[$x]<21) <= 80 ); { echo ('im a fat teapot'."<br><br><br><br><br>"); } if( ($q[$x=1] + $q[$x]<21) >= 81 && ($q[$x=1] + $q[$x]<21) <= 100 ); { echo ('im a jenny craig teapot'."<br><br><br><br>"); } } ?> <HTML> <HEAD> <TITLE> Quiz Results </TITLE> </HEAD> <BODY> <? DisplayQuizResults(); ?> </BODY> </HTML> it isnt working correctly for some reason. no matter what i answer it spits out all outcomes. here is the quiz code i think it is irrelevant though. <?php $qid = "Quiz ID-00"; ?> <html> <head> <title><? echo "NLP VIDEO $qid"; ?></title> <style type="text/css"> .style2 { width: 275px; } .style3 { width: 485px; } .style8 { width: 176px; } </style> </head> <body> <h3><? echo "nlp video $qid"; ?></h3> <form action="results.php" method="post"> <p> Rate on a Scale of 1-5 how each of these questions make you feel.</p> <p> Your Name: <input type="text" name="name"></p> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Questions or little tidbit of words here</td> <td> 1 2 3 4 5 </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="01" name="Q1" type="radio" value="1" /> <input id="02" name="Q1" type="radio" value="2" /> <input id="03" name="Q1" type="radio" value="3" /> <input id="04" name="Q1" type="radio" value="4" /> <input id="05" name="Q1" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="1" name="Q2" type="radio" value="1" /> <input id="2" name="Q2" type="radio" value="2" /> <input id="3" name="Q2" type="radio" value="3" /> <input id="4" name="Q2" type="radio" value="4" /> <input id="5" name="Q2" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="6" name="Q3" type="radio" value="1" /> <input id="7" name="Q3" type="radio" value="2" /> <input id="8" name="Q3" type="radio" value="3" /> <input id="9" name="Q3" type="radio" value="4" /> <input id="10" name="Q3" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="Radio11" name="Q4" type="radio" value="1" /> <input id="Radio12" name="Q4" type="radio" value="2" /> <input id="Radio13" name="Q4" type="radio" value="3" /> <input id="Radio14" name="Q4" type="radio" value="4" /> <input id="Radio15" name="Q4" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio16" name="Q5" type="radio" value="1" /> <input id="Radio17" name="Q5" type="radio" value="2" /> <input id="Radio18" name="Q5" type="radio" value="3" /> <input id="Radio19" name="Q5" type="radio" value="4" /> <input id="Radio20" name="Q5" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio21" name="Q6" type="radio" value="1" /> <input id="Radio22" name="Q6" type="radio" value="2" /> <input id="Radio23" name="Q6" type="radio" value="3" /> <input id="Radio24" name="Q6" type="radio" value="4" /> <input id="Radio25" name="Q6" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="Radio26" name="Q7" type="radio" value="1" /> <input id="Radio27" name="Q7" type="radio" value="2" /> <input id="Radio28" name="Q7" type="radio" value="3" /> <input id="Radio29" name="Q7" type="radio" value="4" /> <input id="Radio30" name="Q7" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio31" name="Q8" type="radio" value="1" /> <input id="Radio32" name="Q8" type="radio" value="2" /> <input id="Radio33" name="Q8" type="radio" value="3" /> <input id="Radio34" name="Q8" type="radio" value="4" /> <input id="Radio35" name="Q8" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio36" name="Q9" type="radio" value="1" /> <input id="Radio37" name="Q9" type="radio" value="2" /> <input id="Radio38" name="Q9" type="radio" value="3" /> <input id="Radio39" name="Q9" type="radio" value="4" /> <input id="Radio40" name="Q9" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="Radio41" name="Q10" type="radio" value="1" /> <input id="Radio42" name="Q10" type="radio" value="2" /> <input id="Radio43" name="Q10" type="radio" value="3" /> <input id="Radio44" name="Q10" type="radio" value="4" /> <input id="Radio45" name="Q10" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio46" name="Q11" type="radio" value="1" /> <input id="Radio47" name="Q11" type="radio" value="2" /> <input id="Radio48" name="Q11" type="radio" value="3" /> <input id="Radio49" name="Q11" type="radio" value="4" /> <input id="Radio50" name="Q11" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio51" name="Q12" type="radio" value="1" /> <input id="Radio52" name="Q12" type="radio" value="2" /> <input id="Radio53" name="Q12" type="radio" value="3" /> <input id="Radio54" name="Q12" type="radio" value="4" /> <input id="Radio55" name="Q12" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="Radio56" name="Q13" type="radio" value="1" /> <input id="Radio57" name="Q13" type="radio" value="2" /> <input id="Radio58" name="Q13" type="radio" value="3" /> <input id="Radio59" name="Q13" type="radio" value="4" /> <input id="Radio60" name="Q13" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio61" name="Q14" type="radio" value="1" /> <input id="Radio62" name="Q14" type="radio" value="2" /> <input id="Radio63" name="Q14" type="radio" value="3" /> <input id="Radio64" name="Q14" type="radio" value="4" /> <input id="Radio65" name="Q14" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio66" name="Q15" type="radio" value="1" /> <input id="Radio67" name="Q15" type="radio" value="2" /> <input id="Radio68" name="Q15" type="radio" value="3" /> <input id="Radio69" name="Q15" type="radio" value="4" /> <input id="Radio70" name="Q15" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio71" name="Q16" type="radio" value="1" /> <input id="Radio72" name="Q16" type="radio" value="2" /> <input id="Radio73" name="Q16" type="radio" value="3" /> <input id="Radio74" name="Q16" type="radio" value="4" /> <input id="Radio75" name="Q16" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio76" name="Q17" type="radio" value="1" /> <input id="Radio77" name="Q17" type="radio" value="2" /> <input id="Radio78" name="Q17" type="radio" value="3" /> <input id="Radio79" name="Q17" type="radio" value="4" /> <input id="Radio80" name="Q17" type="radio" value="5" /> </td> <td> </td> </tr> </tr> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio81" name="Q18" type="radio" value="1" /> <input id="Radio82" name="Q18" type="radio" value="2" /> <input id="Radio83" name="Q18" type="radio" value="3" /> <input id="Radio84" name="Q18" type="radio" value="4" /> <input id="Radio85" name="Q18" type="radio" value="5" /> </td> <td> </td> </tr> </tr> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio86" name="Q19" type="radio" value="1" /> <input id="Radio87" name="Q19" type="radio" value="2" /> <input id="Radio88" name="Q19" type="radio" value="3" /> <input id="Radio89" name="Q19" type="radio" value="4" /> <input id="Radio90" name="Q19" type="radio" value="5" /> </td> <td> </td> </tr> </tr> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio91" name="Q20" type="radio" value="1" /> <input id="Radio92" name="Q20" type="radio" value="2" /> <input id="Radio93" name="Q20" type="radio" value="3" /> <input id="Radio94" name="Q20" type="radio" value="4" /> <input id="Radio95" name="Q20" type="radio" value="5" /> </td> <td> </td> </tr> </table> <p><input type="submit" name="submit" value="Submit Quiz"></p> <input type="hidden" name="qp" value="quiz00.php"> </form> </body> </html> any help will be appreciated
  2. lol im still new to this sorry but still $_get has no realistic database applications that i can see.
  3. http://www.phpvideotutorials.com/lesson09/ 18 minutes in check it out it should help you
  4. people often forget the reason you go with post rather than get. simple really $_get == data gets put into url/ only 100 characters allowed $_post == no data in url/ no character limit i still dont understand why get is even there. i mean post is so much better.
  5. for your learning php part a site i have found very helpful was <a href="http://www.phpwideotutorials.com>this is very nice </a>
  6. Really all i am wandering is why am i getting a white screen when i click submit and score. results.php is messing up
  7. Thanks wolfie. But thats not exactly what im looking for . i will remember that for future reference though .
  8. im not right now i just want it to spit out values. its not a test per say its how do you feel about this rate 1-5. based on that i will add up the numbers then display a custom message for each group ie. 0-20//21-40//41-60//61-80//81-100. i think i can figure that part out i just am wondering really why its not spitting it back to me.
  9. Ok heres my codes messy i know ;p still in learning phase <?php $qid = "Quiz ID-00"; ?> <html> <head> <title><? echo "cheatengine hehe $qid"; ?></title> <style type="text/css"> .style2 { width: 275px; } .style3 { width: 485px; } .style8 { width: 176px; } </style> </head> <body> <h3><? echo "cheatengine fuh $qid"; ?></h3> <form action="results.php" method="post"> <p> Rate on a Scale of 1-5 how each of these questions make you feel.</p> <p> Your Name: <input type="text" name="name"></p> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Questions or little tidbit of words here</td> <td> 1 2 3 4 5 </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="01" name="Q1" type="radio" value="1" /> <input id="02" name="Q1" type="radio" value="2" /> <input id="03" name="Q1" type="radio" value="3" /> <input id="04" name="Q1" type="radio" value="4" /> <input id="05" name="Q1" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="1" name="Q2" type="radio" value="1" /> <input id="2" name="Q2" type="radio" value="2" /> <input id="3" name="Q2" type="radio" value="3" /> <input id="4" name="Q2" type="radio" value="4" /> <input id="5" name="Q2" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="6" name="Q3" type="radio" value="1" /> <input id="7" name="Q3" type="radio" value="2" /> <input id="8" name="Q3" type="radio" value="3" /> <input id="9" name="Q3" type="radio" value="4" /> <input id="10" name="Q3" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="Radio11" name="Q4" type="radio" value="1" /> <input id="Radio12" name="Q4" type="radio" value="2" /> <input id="Radio13" name="Q4" type="radio" value="3" /> <input id="Radio14" name="Q4" type="radio" value="4" /> <input id="Radio15" name="Q4" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio16" name="Q5" type="radio" value="1" /> <input id="Radio17" name="Q5" type="radio" value="2" /> <input id="Radio18" name="Q5" type="radio" value="3" /> <input id="Radio19" name="Q5" type="radio" value="4" /> <input id="Radio20" name="Q5" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio21" name="Q6" type="radio" value="1" /> <input id="Radio22" name="Q6" type="radio" value="2" /> <input id="Radio23" name="Q6" type="radio" value="3" /> <input id="Radio24" name="Q6" type="radio" value="4" /> <input id="Radio25" name="Q6" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="Radio26" name="Q7" type="radio" value="1" /> <input id="Radio27" name="Q7" type="radio" value="2" /> <input id="Radio28" name="Q7" type="radio" value="3" /> <input id="Radio29" name="Q7" type="radio" value="4" /> <input id="Radio30" name="Q7" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio31" name="Q8" type="radio" value="1" /> <input id="Radio32" name="Q8" type="radio" value="2" /> <input id="Radio33" name="Q8" type="radio" value="3" /> <input id="Radio34" name="Q8" type="radio" value="4" /> <input id="Radio35" name="Q8" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio36" name="Q9" type="radio" value="1" /> <input id="Radio37" name="Q9" type="radio" value="2" /> <input id="Radio38" name="Q9" type="radio" value="3" /> <input id="Radio39" name="Q9" type="radio" value="4" /> <input id="Radio40" name="Q9" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="Radio41" name="Q10" type="radio" value="1" /> <input id="Radio42" name="Q10" type="radio" value="2" /> <input id="Radio43" name="Q10" type="radio" value="3" /> <input id="Radio44" name="Q10" type="radio" value="4" /> <input id="Radio45" name="Q10" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio46" name="Q11" type="radio" value="1" /> <input id="Radio47" name="Q11" type="radio" value="2" /> <input id="Radio48" name="Q11" type="radio" value="3" /> <input id="Radio49" name="Q11" type="radio" value="4" /> <input id="Radio50" name="Q11" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio51" name="Q12" type="radio" value="1" /> <input id="Radio52" name="Q12" type="radio" value="2" /> <input id="Radio53" name="Q12" type="radio" value="3" /> <input id="Radio54" name="Q12" type="radio" value="4" /> <input id="Radio55" name="Q12" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td> <input id="Radio56" name="Q13" type="radio" value="1" /> <input id="Radio57" name="Q13" type="radio" value="2" /> <input id="Radio58" name="Q13" type="radio" value="3" /> <input id="Radio59" name="Q13" type="radio" value="4" /> <input id="Radio60" name="Q13" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio61" name="Q14" type="radio" value="1" /> <input id="Radio62" name="Q14" type="radio" value="2" /> <input id="Radio63" name="Q14" type="radio" value="3" /> <input id="Radio64" name="Q14" type="radio" value="4" /> <input id="Radio65" name="Q14" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td> <input id="Radio66" name="Q15" type="radio" value="1" /> <input id="Radio67" name="Q15" type="radio" value="2" /> <input id="Radio68" name="Q15" type="radio" value="3" /> <input id="Radio69" name="Q15" type="radio" value="4" /> <input id="Radio70" name="Q15" type="radio" value="5" /> </td> </tr> </table> <table cellpadding="0" cellspacing="0" class="style3"> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio71" name="Q16" type="radio" value="1" /> <input id="Radio72" name="Q16" type="radio" value="2" /> <input id="Radio73" name="Q16" type="radio" value="3" /> <input id="Radio74" name="Q16" type="radio" value="4" /> <input id="Radio75" name="Q16" type="radio" value="5" /> </td> </tr> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio76" name="Q17" type="radio" value="1" /> <input id="Radio77" name="Q17" type="radio" value="2" /> <input id="Radio78" name="Q17" type="radio" value="3" /> <input id="Radio79" name="Q17" type="radio" value="4" /> <input id="Radio80" name="Q17" type="radio" value="5" /> </td> <td> </td> </tr> </tr> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio81" name="Q18" type="radio" value="1" /> <input id="Radio82" name="Q18" type="radio" value="2" /> <input id="Radio83" name="Q18" type="radio" value="3" /> <input id="Radio84" name="Q18" type="radio" value="4" /> <input id="Radio85" name="Q18" type="radio" value="5" /> </td> <td> </td> </tr> </tr> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio86" name="Q19" type="radio" value="1" /> <input id="Radio87" name="Q19" type="radio" value="2" /> <input id="Radio88" name="Q19" type="radio" value="3" /> <input id="Radio89" name="Q19" type="radio" value="4" /> <input id="Radio90" name="Q19" type="radio" value="5" /> </td> <td> </td> </tr> </tr> <tr> <td class="style8"> Question</td> <td class="style2"> <input id="Radio91" name="Q20" type="radio" value="1" /> <input id="Radio92" name="Q20" type="radio" value="2" /> <input id="Radio93" name="Q20" type="radio" value="3" /> <input id="Radio94" name="Q20" type="radio" value="4" /> <input id="Radio95" name="Q20" type="radio" value="5" /> </td> <td> </td> </tr> </table> <p><input type="submit" name="submit" value="Submit Quiz"></p> <input type="hidden" name="qp" value="quiz00.php"> </form> </body> </html> and the php side that keeps bitching at me for no real reason that i can see i havent even started to put in the operators yet. this is just a simple eot( echo on crack ) and it keeps giving me blank page HELP PLZ im sure its something dumb <?php $title = "Quiz Results"; echo "<title>$title</title>"; // Below gets the answers from the page before // if (isset ($_POST['submit'])) { $name = $_POST['name']; $Q1 = $_POST['Q1']; $Q2 = $_POST['Q2']; $Q3 = $_POST['Q3']; $Q4 = $_POST['Q4']; $Q5 = $_POST['Q5']; $Q6 = $_POST['Q6']; $Q7 = $_POST['Q7']; $Q8 = $_POST['Q8']; $Q9 = $_POST['Q9']; $Q10 = $_POST['Q10']; $Q11 = $_POST['Q11']; $Q12 = $_POST['Q12']; $Q13 = $_POST['Q13']; $Q14 = $_POST['Q14']; $Q15 = $_POST['Q15']; $Q16 = $_POST['Q16']; $Q17 = $_POST['Q17']; $Q18 = $_POST['Q18']; $Q19 = $_POST['Q19']; $Q20 = $_POST['Q20']; $qp = $_POST['qp']; } // Below checks to see if you forgot anything // if ($name == "") { die ("Please insert name."); } if ($Q1 == "") { die ("you forgot to fill in question 1"); } if ($q2 == "") { die ("you forgot to fill in question 2"); } if ($q3 == "") { die ("you forgot to fill in question 3"); } if ($q4 == "") { die ("you forgot to fill in question 4"); } if ($q5 == "") { die ("you forgot to fill in question 5"); if ($q6 == "") { die ("you forgot to fill in question 6"); if ($q7 == "") { die ("you forgot to fill in question 7"); if ($q8 == "") { die ("you forgot to fill in question 8"); if ($q9 == "") { die ("you forgot to fill in question 9"); if ($q10 == "") { die ("you forgot to fill in question 10"); if ($q11 == "") { die ("you forgot to fill in question 11"); if ($q12 == "") { die ("you forgot to fill in question 12"); if ($q13 == "") { die ("you forgot to fill in question 13"); if ($q14 == "") { die ("you forgot to fill in question 14"); if ($q15 == "") { die ("you forgot to fill in question 15"); if ($q16 == "") { die ("you forgot to fill in question 16"); if ($q17 == "") { die ("you forgot to fill in question 17"); if ($q18 == "") { die ("you forgot to fill in question 18"); if ($q19 == "") { die ("you forgot to fill in question 19"); if ($q20 == "") { die ("you forgot to fill in question 20"); } // Below is where the answers are actually displayed // { echo<<<EOT <p>Results: $name<br> 1.) $q1<br> 2.) $q2<br> 3.) $q3<br> 4.) $q4<br> 5.) $q5<br> 6.) $q6<br> 7.) $q7<br> 8.) $q8<br> 9.) $q9<br> 10.) $q10<br> 11.) $q11<br> 12.) $q12<br> 13.) $q13<br> 14.) $q14<br> 15.) $q15<br> 16.) $q16<br> 17.) $q17<br> 18.) $q18<br> 19.) $q19<br> 20.) $q20</p> EOT; } ?> Please dont flame i know its shit but its my first crack at php so give me a break
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.