Jump to content

Lukie_boy

New Members
  • Posts

    2
  • Joined

  • Last visited

Lukie_boy's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. not to worry solved! I have to use file_get_contents() instead.
  2. Hi chaps if you could help me out with this it would be great! What I'm making is a quiz game and the problem i'm having is with echoing includes now I can do that fine but is echoing all of them?!? what it is ment to do is if you get a question right or wrong it will display a fact about the answer chosen, that's what in the includes are for so you pick one answer from a radio button from the other page it parse the date to here, adjust lives and score(that works fine) then displays the info. I have been messing around with the code for a few hours now and it gotta be something wrong with the structure? thanks in advance Luke <?php session_start(); $answer = $_POST['q1']; $ans1 = include('ans/q1a1.php'); $ans2 = include('ans/q1a2.php'); $ans3 = include('ans/q1a3.php'); $ans4 = include('ans/q1a4.php'); $ans5 = include('ans/q1a5.php'); $ans6 = include('ans/q1a6.php'); if ($answer == "answer4") { echo "$ans4". $_SESSION['score'] += 1;} elseif($answer == "answer1") {echo "$ans1". $_SESSION['lives'] -= 1;} elseif($answer == "answer2") {echo "$ans2". $_SESSION['lives'] -= 1;} elseif($answer == "answer3") {echo "$ans3". $_SESSION['lives'] -= 1;} elseif($answer == "answer5") {echo "$ans5". $_SESSION['lives'] -= 1;} else($answer == "answer6") {echo "$ans6". $_SESSION['lives'] -= 1;} Print_r ($_SESSION); session_destroy(); ?>
×
×
  • Create New...