bonjours à vous ! voilà j'ai un pb avec les variables de session , je ne comprendrai vraiment jamais les sessions. Sa marche 1 jour sur 2.
Bref voilà le probleme
ici je fais saisir 2 variables à l'aide d'un formulaire login et pass
<?
session_start();
?>
<html>
<head>
<link href="..\..\Fonction\Style1.css" rel="stylesheet" type="text/css">
<title></title>
</head>
<body background="..\image\fond Princ.jpg">
<FORM ACTION ="debutGET.php" TARGET="Main" METHOD="POST">
<h1> Création de Personnage ! </h1><br />
<h5> Pseudo </h5>
<br>
<center>
<table width="60%" border="1">
<td width="20%">
<h3> Choisissez votre héros </h3>
<center><select size="1" name="hero">
<option>Guerrier</option>
<option>Mage</option>
<option>Necromancien</option>
<option>Druide</option>
</select></center>
</td>
<td width="20%">
<h3> PSEUDO : </h3>
<center><input type="text" name="pseudo" size="10">
<br>
<br>
<center><input type="submit" value="Valider"></center>
</td></table>
</body>
</html>
ensuite j'enregistre donc mes 2 variables dans la session
<?
session_start();
?>
<html>
<head>
<link href="..\..\Fonction\Style1.css" rel="stylesheet" type="text/css">
<title></title>
</head>
<body background="..\image\fond Princ.jpg">
<?
include("../../Fonction/simple_mysql_ifu.inc.php");
$base='siteith';
$host='localhost';
$user='root';
$pass='';
$_SESSION['pseudo'] = $_POST['pseudo'];
$_SESSION['hero'] = $_POST['hero'];
echo '<META http-EQUIV="Refresh" TARGET="Main" CONTENT="0; url=etape0.php">';
?>
</body>
</html>
aprés rien de plus simple je fais une redirection sur etape0.php qui se charge d'afficher la variable de session hero
<?
session_start();
?>
<html>
<head>
<link href="..\..\Fonction\Style1.css" rel="stylesheet" type="text/css">
<title></title>
</head>
<body background="..\image\fond Princ.jpg">
<?
include("../../Fonction/simple_mysql_ifu.inc.php");
$base='siteith';
$host='localhost';
$user='root';
$pass='';
?>
<h1> Création de votre personnage </h1><br>
<?
echo '<h5> Définir les caractéristiques de votre '.$_SESSION['hero'].' </h5>';
?>
</body>
</html>
et en réponse j'ai un message d'erreur comme quoi la variable hero est indéfinie ... pourquoi ?