message d'erreur dans session
Bonsoir
Un nouveau problème se pose a moi.
Voici le code
page.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| <?php
session_start();
?>
<FORM method="POST">
<input type="checkbox" name="choix1" id="1"><label for="1">Dossier 1</label><br>
<input type="checkbox" name="choix2" id="2"><label for="2">Dossier 2</label><br>
<input type="checkbox" name="choix3" id="3"><label for="3">Dossier 3</label><br>
<input type="Submit" value="Valider">
</FORM>
<br><br>
<?php
if(isset($_POST["choix1"])) {
$choix1 = "Le choix 1 a été selectionné
<br>";
echo $choix1;
}
if(isset($_POST["choix2"])) {
$choix2 = "Le choix 2 a été selectionné
<br>";
echo $choix2;
}
if(isset($_POST["choix3"])) {
$choix3 = "Le choix 3 a été selectionné
<br>";
echo $choix3;
}
$_SESSION['choix1'] = $choix1;
$_SESSION['choix2'] = $choix2;
$_SESSION['choix3'] = $choix3;
?>
<br>
<a href="page1.php">suite</a> |
et le code page1.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <?php
session_start();
if ( isset($_SESSION['choix1']) OR isset($_SESSION['choix2']) OR isset($_SESSION['choix3']))
{
echo $_SESSION['choix1'];
echo $_SESSION['choix2'];
echo $_SESSION['choix3'];
}
else{
header('Location: page.php');
}
?> |
Donc je met en session les valeur de la / les checkbox.
Ca fonctionne très bien, sauf que sur la page.php, j'ai systématiquement ce message d'erreur:
Notice: Undefined variable: choix1 in E:\A_PC PORTABLE\www\choix des dossiers\page.php on line 30
Notice: Undefined variable: choix2 in E:\A_PC PORTABLE\www\choix des dossiers\page.php on line 31
Notice: Undefined variable: choix3 in E:\A_PC PORTABLE\www\choix des dossiers\page.php on line 32
Une idée svp???