mardi 27 juin 2017

please help me with this goto statement

  '<?php
      $score=0;
   $i=0;  
   function icremm($i) {
    $Question1=array( "answer1aa","answer1b","answer1c","answer1d");
 $Question2=array( "answer2a","answer2bb","answer2c","answer2d");
   $Question3=array( "answer3a","answer3b","answer3c","answer3dd ");
 $allquest=(array($Question1,$Question2,$Question3));

 $rand1=$allquest[$i];
 ?>
  <form method="POST">
 <input  type="submit"  name="1b"   value="<?php echo $rand1[0] ?>"/>
 <input  type="submit"   name="2b"  value="<?php echo $rand1[1] ?>" />
   <input  type="submit"   name="3b"  value=" <?php echo $rand1[2] ?>" />
 <input  type="submit"   name="4b"   value="<?php echo $rand1[3] ?>"  />
</form>
    <?php 
   echo "<br>";
  global $score;
  echo $score;
 echo "<br>";
  echo "<br>";
   global $i;
 echo $i;
}  
  icremm($i);

   if  (isset($_POST["1b"]) )  {
    $score+=5; 
     $i++;

   goto L1;  
   }  

       if( $i==0 && isset($_POST["2b"]) || $i==0 &&  isset($_POST["3b"]) 
        ||       $i==0     &&  isset($_POST["4b"]) )  {
  header("Location: lost.php");
   }
  L1:{
   @ob_end_clean(); 
  icremm($i);


    if  (isset($_POST["2b"]) )  {
     $score+=5;
     $i++;
 @ob_end_clean();         
 echo"you won";

    }   
   } 

   ?>'



1.i try  making my first  gamee like "who wants to be a millionaire" and   

 when i answer first question and go to L1 the first statement(//if(   

$i==0 &&

isset($_POST["2b"]) || $i==0 && //isset($_POST["3b"]) ||$i==0 &&

isset($_POST["4b"]) ) { // header("Location: lost.php");) still works

  1. but i want to My L1 statement to work
    please help me with this goto statement

Aucun commentaire:

Enregistrer un commentaire