Page 1 sur 1

Pagination questionnaire

Posté : 09 mars 2016, 16:36
par jessyd
Bonjour,

Je rencontre actuellement un problème avec mon code, j'aimerai pouvoir faire une pagination pour chaque questions d'un fichier texte. J'arrive à afficher mes questions et réponses, et aussi à voir si les bonnes réponses ont été choisis, mais par contre je ne sais vraiment pas comment m'y prendre avec mon code actuel, voici ce dernier :
<form action="index.php" method="POST" name="form">
<?php
for($i=0, $max=count($lines) ; $i<$max ; $i++){
  if (substr($lines[$i],0,1)==$cherchquestion){
	$linesquestion[$i] = str_replace("*", "", $lines[$i]);
    echo $linesquestion[$i];
	echo "<br />";
  }
  if (substr($lines[$i],0,1)==$cherchreponse){
	$linesreponse[$i] = str_replace("+", "", $lines[$i]);
	echo "$linesreponse[$i] <input type='checkbox' name='Reponse[$i]' value='$linesreponse[$i]'>";
	echo "<br />";
  }
  if (substr($lines[$i],0,1)==$cherchcorrect){
	$linesrcorrect[$i] = str_replace("-", "", $lines[$i]);
	echo $linesrcorrect[$i];
  }
}

echo "<br />";
echo "<br />";
echo "<input type='submit' value='envoyer'>";
$arraychoix = array();
$arraybonnerep = array();
if(isset($_POST['Reponse'])){
	foreach($_POST['Reponse'] as $choix){
		$arraychoix[] = $choix;
	}
	
	foreach($linesrcorrect as $bonnerep){
		$arraybonnerep[] = $bonnerep;
	}
	
	for($i=0, $max=count($arraybonnerep) ; $i<$max ; $i++){
		if($arraychoix[$i] == $arraybonnerep[$i]) {
			echo "Bonne reponse : ";
			print $arraychoix[$i];
		}
		else { echo "Mauvaise reponse";}
	}
	
	}
A l'affichage j'ai :
Question : reponse-reponse...ect Question : reponse...ect
Et j'aimerai pouvoir séparer chaque question via une pagination.
Merci d'avance pour votre aide.