Probleme passage de variables PHP

Résolu/Fermé
virtualsof Messages postés 106 Date d'inscription mercredi 27 septembre 2006 Statut Membre Dernière intervention 17 août 2014 - 28 sept. 2008 à 22:49
virtualsof Messages postés 106 Date d'inscription mercredi 27 septembre 2006 Statut Membre Dernière intervention 17 août 2014 - 29 sept. 2008 à 01:01
Bonjour,

Je n'arrive pas à comprendre pourquoi les variables de mon formulaires ne veulent pas s'afficher sur la page "Commande.php". Est-ce qu'une âme charitable pourrais m'aider svp ?

J'ai tout d'abord une liste de liens tirée d'une BDD dans lesquels je transmet l'ID de l'événement sur une page que je nomme liste.php et sur laquelle j'affiche le détail de l'évènement :

inscription.php?id=29


Voici le code de mon formulaire inscription.php qui permet de s'incrire à cet évènement :

<?php
if (!isset($_SESSION)) {
  session_start();
}

if (isset($_GET['id'])); {
$ideven = $_GET['id'];
}
?>
<html>
<head>
<title>Inscription en ligne</title>
</head>
<body>
<h3>Formulaire d'inscription :</h3>

<form method='post' action="commande.php">

            <table width="100%">
                <tr>
                  <td>Nom : *</td>
                  <td><input type="text" name="nom" id="nom"></td>

                  <td>Prénom : *</td>
                  <td><input type="text" name="prenom" id="prenom"></td>
              </tr>
          <tr>
            <td>Adresse personnelle : *</td>
            <td><textarea name="adresse" cols="30"></textarea></td>

            <td>Code Postal : *</td>
            <td><input type="text" name="cp"></td>

         </tr>
          <tr>
              <td>Ville : *</td>
              <td><input type="text" name="ville" id="ville"></td>

              <td>Pays : </td>
              <td><input name="pays" type="text" value="France" id="pays"></td>
                </tr>

                <tr>
                   <td>Téléphone : *</td>
                  <td><input type="text" name="telephone" id="telephone"></td>

                    <td>Fax :</td>
                    <td><input type="text" name="fax" id="fax"></td>
                </tr>

                <tr>
                  <td>Adresse mail : *</td>
                  <td><input type="text" size="40" name="mail" id="mail"></td>
                </tr>

            </table>
        <div align="center"><input type="submit" name="envoyer" value="Envoyer">&nbsp;<input type="reset" value="Annuler"></div>
        <input type="hidden" value="<?php echo $ideven ?>">
</form>
</body>
</html>


Et enfin le code de la page "Commande.php" qui récapitule les informations saisies et confirme la validation :

<?php
if (!isset($_SESSION)) {
  session_start();
}

if (isset($_POST['ideven']))	$_SESSION['CADDIE_ID']= $_POST['ideven'];
else      $_SESSION['CADDIE_ID']="";


if(isset($_POST['nom']))		$_SESSION['USER_NOM']=$_POST['nom'];
else      $_SESSION['USER_NOM']="";

if(isset($_POST['prenom']))		$_SESSION['USER_PRENOM']=$_POST['prenom'];
else      $_SESSION['USER_PRENOM']="";

if(isset($_POST['adresse']))	$_SESSION['USER_ADRESSE']=$_POST['adresse'];
else      $_SESSION['USER_ADRESSE']="";

if(isset($_POST['cp']))      	$_SESSION['USER_ZIP']=$_POST['cp'];
else      $_SESSION['USER_ZIP']="";

if(isset($_POST['ville']))		$_SESSION['USER_VILLE']=$_POST['ville'];
else      $_SESSION['USER_VILLE']="";

if(isset($_POST['pays']))      	$_SESSION['USER_PAYS']=$_POST['pays'];
else      $_SESSION['USER_PAYS']="";


if(isset($_POST['tel']))      	$_SESSION['USER_TEL']=$_POST['tel'];
else      $_SESSION['USER_TEL']="";

if(isset($_POST['mail']))		$_SESSION['USER_EMAIL']=$_POST['mail'];
else      $_SESSION['USER_EMAIL']="";
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Inscription en ligne</title>
</head>
<body>
<div align=center>
  <table width="100%">
       <tr>
      <td>Nom : </td>
      <td><?php echo $USER_NOM ?></td>
      <td>Pr&eacute;nom :</td>
      <td><?php echo $USER_PRENOM ?></td>
    </tr>
    <tr>
      <td>Adresse personnelle : </td>
      <td><?php echo $USER_ADRESSE ?></td>
      <td>Code Postal : </td>
      <td><?php echo $USER_ZIP ?></td>
    </tr>
    <tr>
      <td>Ville :</td>
      <td><?php echo $USER_VILLE ?></td>
      <td>Pays : </td>
      <td><?php echo $USER_PAYS ?></td>
    </tr>
    <tr>
      <td>T&eacute;l&eacute;phone : </td>
      <td><?php echo $USER_TEL ?></td>
      <td>Fax :</td>
      <td><?php echo $USER_FAX ?></td>
    </tr>
    <tr>
      <td>Adresse mail :</td>
      <td><?php echo $USER_MAIL ?></td>
      
    </tr>
  </table>
  <div align="center">ANNULER</div>
</body>
</html>
</body>
</html>


Je suis sûr que je ne suis pas loin mais je désespère...

D'avance merci
A voir également:

2 réponses

virtualsof Messages postés 106 Date d'inscription mercredi 27 septembre 2006 Statut Membre Dernière intervention 17 août 2014 17
29 sept. 2008 à 01:01
Oui C'est exact, effectivement, en fait en relisant mon post après l'avoir posté :/ je me suis rendu compte de ma bourde...

Merci jerome_64 d'avoir pris le tps de me répondre
1
jerome_64 Messages postés 14 Date d'inscription dimanche 28 septembre 2008 Statut Membre Dernière intervention 1 octobre 2008 1
29 sept. 2008 à 00:49
Bonjour il faut que tu récupères les informations de la session:
dans ton exemple:
<tr>
<td>Nom : </td>
<td><?php echo $USER_NOM ?></td>
<td>Prénom :</td>
<td><?php echo $USER_PRENOM ?></td>
</tr>

$USER_NOM ou $USER_PRENOM n'existe pas, il faut rajouter $_SESSION soit:

<tr>
<td>Nom : </td>
<td><?php echo $_SESSION['USER_NOM'] ?></td>
<td>Prénom :</td>
<td><?php echo $_SESSION['USER_PRENOM'] ?></td>
</tr>
-1