IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Récupérer Check-box par php


Sujet :

Langage PHP

  1. #1
    Membre régulier
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Janvier 2010
    Messages
    119
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Janvier 2010
    Messages : 119
    Points : 77
    Points
    77
    Par défaut Récupérer Check-box par php
    Salut, j'ai un tableau où j'ai récupéré des données de ma base de données,
    devant chaque ligne j'ai un checkbox. J'ai un bouton valider en dessous du tableau et je veux afficher dans un autre tableau les lignes sélectionnées par la checkbox lorsqu'on clique sur le bouton.
    Mon code ci-dessous ne me renvoie pas le résultats attendus et je sais vraiment pas où se situe le problème.

    Formulaire du premier tableau :
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    <div id="titre_tab">CONSULTATION DES RAPPORTS D'ACTIVITES HEBDOMADAIRES
    <form method="POST" action="consultation_rah.php" name="consultation_rah" onSubmit="return verifier();return verif(formule)" enctype="multipart/form-data" >
    <div id="fieldset1">
    <fieldset style="width:360px;">
           <legend><strong>SELECTIONNER</strong></legend> 
    	    <p>
    		 <label for="id"><strong>Date 1 : </strong> </label>
             <input type="date" name="date1" id="date1" tabindex="10" /><br />
    		 <label for="id"><strong>Date 2 : </strong> </label>
             <input type="date" name="date2" id="date2" tabindex="10" /><br /><br />
    		 <input type="radio" name="Choix" value="Generale" checked>Generale
    		 <input type="radio" name="Choix" value="Suivi">Suivi
    		 <input type="radio" name="Choix" value="Conclu">Termin&eacute;es
            </p>
    </fieldset>
    </div>
    <fieldset id="consul" style="width:360px;">
           <legend><strong>OPTIONS</strong></legend> 
    	    <p>
    		<input type="submit" name="Valider" id="Valider" value="Valider" /> 
    	   <input type="submit" name="Annuler" id="Annuler" value="Annuler" />  
            </p>
    </fieldset> <br/>
    </form>	
    </div>

    Resultat de l'affichage du premier tableau, selection des checkbox et requete pour afficher le deuxième tableau :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    <?php
    include("connection_gescompta.php");
     $i=0;
    //**************************************************************************************************************************************			
    // Consultation Generale
    if (isset($_POST['Valider']))
    {
    	$Choix  = $_POST['Choix'];
            //echo $Choix;
    	if ($Choix == 'Generale')
    	{
    		echo '<table><tr>
    		<th> RAM </th>
    		<th> ID </th>
    		<th>DATE </th>
    		<th>PROJETS / TÂCHES</th>
    		<th>DESCRIPTION</th>
    		<th>ETAT D’AVANCEMENT	</th>
    		<th>RESPONSABLE </th>
    		<th>ETAT </th>
    		<th>MODIFIER</th>
    		<th>SUPPRIMER</th>
    		</tr>';
    		try
    		{
    		$date1 = $_POST['date1'];
    		$date2 = $_POST['date2'];
    			 $reponse = $bdd->query("SELECT 
    	 a.id_rah,
         a.datejour,
    	 a.projets_taches,
    	 a.description,
    	 a.avancement,
    	 a.entite_responsable,
    	 a.etat_tache
         FROM 
         rah a
    	 where datejour between '$date1' and '$date2' order by a.datejour");
     
    			while ($donnees = $reponse->fetch())
    			{
    				$i++;
    				echo '<tr>';
    					echo '
    					
    					<td><input type="checkbox" name="checkbox[]"  value ="<?php echo '.$donnees['id_rah'].'?>" /></td>
    					<td>'. $donnees['id_rah'].'</td>
    					<td>'. $donnees['datejour'].'</td>
    					<td>'. $donnees['projets_taches'].'</td>
    					<td>'. $donnees['description'].'</td>
    					<td>'. $donnees['avancement'].'</td>
    					<td>'. $donnees['entite_responsable'].'</td>
    					<td>'. $donnees['etat_tache'].'</td>';
    					echo'<td><a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a></td>';
    					echo'<td><a href="confirmation_sup_rah.php?supprimer='.$donnees['id_rah'].'"><img src="images/supprimer.jpg"></a></td>';
    				echo '</tr>';
     
    			}
    			}
    			catch(Exception $e)
                {
                     die('Erreur : '.$e->getMessage());
                }
     
    			   }
     
     
    			   echo '</table>';
     
    //**************************************************************************************************************************************			 
     
    			 // Consultation des RAH suivi
     
    			     if ($Choix == 'Suivi')
    	                 {
     
    			      echo '<table><tr>
    				<th> RAM </th>
    				<th>DATE </th>
    				<th>PROJETS / TÂCHES</th>
    				<th>DESCRIPTION</th>
    				<th>ETAT D’AVANCEMENT	</th>
    				<th>RESPONSABLE </th>
    				<th>ETAT </th>
    				<th>MODIFIER</th>
    				<th>SUPPRIMER</th>
    				</tr>';
     
    			try
    			{
     
     
    		$date1 = $_POST['date1'];
    		$date2 = $_POST['date2'];
    			 $reponse = $bdd->query("SELECT 
    	 a.id_rah,
         a.datejour,
    	 a.projets_taches,
    	 a.description,
    	 a.avancement,
    	 a.entite_responsable,
    	 a.etat_tache
         FROM 
         rah a
    	 where datejour between '$date1' and '$date2' and
    	 etat_tache = 'Suivi' order by a.datejour");
     
    			while ($donnees = $reponse->fetch())
    			{
    				$i++;
    				echo '<tr>';
    					echo '
     
    					<td><input  type="checkbox" name="checkbox[]"   value ="<?php echo '.$donnees['id_rah'].'?>" /></td>
    					<td>'. $donnees['datejour'].'</td>
    					<td>'. $donnees['projets_taches'].'</td>
    					<td>'. $donnees['description'].'</td>
    					<td>'. $donnees['avancement'].'</td>
    					<td>'. $donnees['entite_responsable'].'</td>
    					<td>'. $donnees['etat_tache'].'</td>';
    					echo'<td><a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a></td>';
    					echo'<td><a href="confirmation_sup_rah.php?supprimer='.$donnees['id_rah'].'"><img src="images/supprimer.jpg"></a></td>';
    				echo '</tr>';
    			}
    			}
    			catch(Exception $e)
                {
                     die('Erreur : '.$e->getMessage());
                }
     
    			   }
     
     
    			   echo '</table>';
    //**************************************************************************************************************************************			 
     
    			 // Consultation des RAHTermin Termin&eacute;es
     
    			     if ($Choix == 'Conclu')
    	                 {
     
    			      echo '<table><tr>
    				<th> RAM </th>
    				<th>DATE </th>
    				<th>PROJETS / TÂCHES</th>
    				<th>DESCRIPTION</th>
    				<th>ETAT D’AVANCEMENT	</th>
    				<th>RESPONSABLE </th>
    				<th>ETAT </th>
    				<th>MODIFIER</th>
    				<th>SUPPRIMER</th>
    				</tr>';
     
    			try
    			{
     
     
    		$date1 = $_POST['date1'];
    		$date2 = $_POST['date2'];
    			 $reponse = $bdd->query("SELECT 
    	 a.id_rah,
         a.datejour,
    	 a.projets_taches,
    	 a.description,
    	 a.avancement,
    	 a.entite_responsable,
    	 a.etat_tache
         FROM 
         rah a
    	 where datejour between '$date1' and '$date2' and
    	 etat_tache = 'Conclue' order by a.datejour");
     
    			while ($donnees = $reponse->fetch())
    			{
    				$i++;
    				echo '<tr>';
    					echo '
     
    					<td><input type="checkbox" name="checkbox[]" value ="<?php echo '.$donnees['id_rah'].'?>" /></td>
    					<td>'. $donnees['datejour'].'</td>
    					<td>'. $donnees['projets_taches'].'</td>
    					<td>'. $donnees['description'].'</td>
    					<td>'. $donnees['avancement'].'</td>
    					<td>'. $donnees['entite_responsable'].'</td>
    					<td>'. $donnees['etat_tache'].'</td>';
    					echo'<td><a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a></td>';
    					echo'<td><a href="confirmation_sup_rah.php?supprimer='.$donnees['id_rah'].'"><img src="images/supprimer.jpg"></a></td>';
    				echo '</tr>';
    			}
    			}
    			catch(Exception $e)
                {
                     die('Erreur : '.$e->getMessage());
                }
     
    			   }
     
     
    			 echo '</table>';
    			 echo '<div id="form2">';
    			 echo '<form method="POST" action="consultation_rah.php" name="consultation_rah" >';
    			 echo ' <br/> <br/> <br/>';
    			 echo '<fieldset id="consul_ram" style="width:360px;">';
    			 echo ' <legend><strong>OPTIONS</strong></legend> ';
    			 echo '<p>';
    			 echo '<input type="submit" name="generer_ram" id="generer_ram" value="RAM" /> ';
    			 echo ' <input type="submit" name="Annuler" id="Annuler" value="Annuler" />  ';
    			 echo ' </p>';
    			 echo '</fieldset> <br/>';
    			 echo '</form>	';
    			 echo '</div >';
    			 }
    /******************************************************************************************************************************/
                   /**************** Traitement du RAM *************************************/
    if (isset($_GET['generer_ram'])  && !empty($_GET['checkbox']))
    	           {
     
    			    $checkbox = array($_GET['checkbox']);
    			     echo '<table><tr>
    				<th>DATE </th>
    				<th>PROJETS / TÂCHES</th>
    				<th>DESCRIPTION</th>
    				<th>ETAT D’AVANCEMENT</th>
    				<th>RESPONSABLE </th>
    				<th>ETAT </th>
    				</tr>';
     
                     $tabCheckbox = array($_GET['checkbox']);
                     foreach ($tabCheckbox as $checkbox) 
    				 {
                     $checkbox = htmlspecialchars($checkbox);
                     $reponse = $bdd->query("SELECT 
    	             a.id_rah,
    				 a.datejour,
    				 a.projets_taches,
    				 a.description,
    				 a.avancement,
    				 a.entite_responsable,
    				 a.etat_tache
    				 FROM 
    				 rah a 
    				 where a.datejour = '$checkbox' order by a.datejour");
     
    				$donnees = $reponse->fetch();
    				$i++;
    				echo '<tr>';
    					echo '
    					<td>'. $donnees['datejour'].'</td>
    					<td>'. $donnees['projets_taches'].'</td>
    					<td>'. $donnees['description'].'</td>
    					<td>'. $donnees['avancement'].'</td>
    					<td>'. $donnees['entite_responsable'].'</td>
    					<td>'. $donnees['etat_tache'].'</td>';
    				echo '</tr>';
     
     
                   }
     
           }
        else
    	  { 
    	     //echo "<script langage='javascript'>alert('Faites le choix d'une tache dans le RAH ...');</script>";
             //echo "Faites le choix d'une tache dans le RAH ...";
    		 //redirect('consultation_rah.php'); 
    	  }
     
     ?>
    Un var_dump($_POST['checkbox']); à l'interieur de la condition
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    if (isset($_GET['generer_ram'])  && !empty($_GET['checkbox']))
    	           {
    			   }
    a été fait mais je n'obtiens aucun résultat.

    si quelqu'un peut m'aider!!!!! c'est très urgent!!!

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonjour,
    Où est la balise <form> autour de la <table> ?
    Et en method="POST", il ne faut pas espérer grand chose d'un $_GET...

    + erreur de syntaxe ligne 50 (echo dans un echo )
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    echo '
    //......
    	<td><input type="checkbox" name="checkbox[]"  value ="'.$donnees['id_rah'].'" /></td>
    //.....
    ';

    [EDIT] C'est avec CA que tu comptais modifier les lignes ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a>
    De ce soit $_GET ou $_POST, ne t'étonne pas de ne pas récupérer tes checkbox !
    Dernière modification par Invité ; 26/10/2013 à 13h55.

  3. #3
    Membre régulier
    Homme Profil pro
    Technicien réseau
    Inscrit en
    Janvier 2010
    Messages
    119
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations professionnelles :
    Activité : Technicien réseau
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Janvier 2010
    Messages : 119
    Points : 77
    Points
    77
    Par défaut
    Bonsoir jreaux62,
    merci d'avoir pris le temps de répondre au sujet.
    En ce qui concerne la ligne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a>
    il n' y a aucun problème, elle me permet de faire une modification sans problème. Je récupéré simplement par GET et je fais ma requête qui exécute ma modification sans problème.

    Les modifications suggérées au niveau des balises <form> autour de la <table> et l'erreur de syntaxe (echo dans un echo) ont été effectuées mais je n'obtiens toujours aucun resultat après selection des checkbox.

    merci de vérifier ci-dessous le code source.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
     
    <?php
    			include("connection_gescompta.php");
    			 $i=0;
    //**************************************************************************************************************************************			
    			// Consultation Generale
     
              if (isset($_POST['Valider']))
    	           {
    			      $Choix  = $_POST['Choix'];
                      //echo $Choix;
    			      if ($Choix == 'Generale')
    	                 {
    			      echo '<form>';
    			      echo '<table><tr>
    				<th> RAM </th>
    				<th> ID </th>
    				<th>DATE </th>
    				<th>PROJETS / TÂCHES</th>
    				<th>DESCRIPTION</th>
    				<th>ETAT D’AVANCEMENT	</th>
    				<th>RESPONSABLE </th>
    				<th>ETAT </th>
    				<th>MODIFIER</th>
    				<th>SUPPRIMER</th>
    				</tr>';
     
    			try
    			{
     
     
    		$date1 = $_POST['date1'];
    		$date2 = $_POST['date2'];
    			 $reponse = $bdd->query("SELECT 
    	 a.id_rah,
         a.datejour,
    	 a.projets_taches,
    	 a.description,
    	 a.avancement,
    	 a.entite_responsable,
    	 a.etat_tache
         FROM 
         rah a
    	 where datejour between '$date1' and '$date2' order by a.datejour");
     
    			while ($donnees = $reponse->fetch())
    			{
    				$i++;
    				echo '<tr>';
    					echo '
    					
    					<td><input type="checkbox" name="checkbox[]"  value ="'.$donnees['id_rah'].'"/></td>
    					<td>'. $donnees['id_rah'].'</td>
    					<td>'. $donnees['datejour'].'</td>
    					<td>'. $donnees['projets_taches'].'</td>
    					<td>'. $donnees['description'].'</td>
    					<td>'. $donnees['avancement'].'</td>
    					<td>'. $donnees['entite_responsable'].'</td>
    					<td>'. $donnees['etat_tache'].'</td>';
    					echo'<td><a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a></td>';
    					echo'<td><a href="confirmation_sup_rah.php?supprimer='.$donnees['id_rah'].'"><img src="images/supprimer.jpg"></a></td>';
    				echo '</tr>';
     
    			}
    			}
    			catch(Exception $e)
                {
                     die('Erreur : '.$e->getMessage());
                }
     
    			   }
     
     
    			   echo '</table>';
    			   echo '</form>';
     
    //**************************************************************************************************************************************			 
     
    			 // Consultation des RAH suivi
     
    			     if ($Choix == 'Suivi')
    	                 {
    			      echo '<form>';
    			      echo '<table><tr>
    				<th> RAM </th>
    				<th>DATE </th>
    				<th>PROJETS / TÂCHES</th>
    				<th>DESCRIPTION</th>
    				<th>ETAT D’AVANCEMENT	</th>
    				<th>RESPONSABLE </th>
    				<th>ETAT </th>
    				<th>MODIFIER</th>
    				<th>SUPPRIMER</th>
    				</tr>';
     
    			try
    			{
     
     
    		$date1 = $_POST['date1'];
    		$date2 = $_POST['date2'];
    			 $reponse = $bdd->query("SELECT 
    	 a.id_rah,
         a.datejour,
    	 a.projets_taches,
    	 a.description,
    	 a.avancement,
    	 a.entite_responsable,
    	 a.etat_tache
         FROM 
         rah a
    	 where datejour between '$date1' and '$date2' and
    	 etat_tache = 'Suivi' order by a.datejour");
     
    			while ($donnees = $reponse->fetch())
    			{
    				$i++;
    				echo '<tr>';
    					echo '
    					
    					<td><input  type="checkbox" name="checkbox[]"   value ="'.$donnees['id_rah'].'" /></td>
    					<td>'. $donnees['datejour'].'</td>
    					<td>'. $donnees['projets_taches'].'</td>
    					<td>'. $donnees['description'].'</td>
    					<td>'. $donnees['avancement'].'</td>
    					<td>'. $donnees['entite_responsable'].'</td>
    					<td>'. $donnees['etat_tache'].'</td>';
    					echo'<td><a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a></td>';
    					echo'<td><a href="confirmation_sup_rah.php?supprimer='.$donnees['id_rah'].'"><img src="images/supprimer.jpg"></a></td>';
    				echo '</tr>';
    			}
    			}
    			catch(Exception $e)
                {
                     die('Erreur : '.$e->getMessage());
                }
     
    			   }
     
     
    			   echo '</table>';
    			   echo '</form>';
    //**************************************************************************************************************************************			 
     
    			 // Consultation des RAHTermin Termin&eacute;es
     
    			     if ($Choix == 'Conclu')
    	                 {
    			      echo '<form>';
    			      echo '<table><tr>
    				<th> RAM </th>
    				<th>DATE </th>
    				<th>PROJETS / TÂCHES</th>
    				<th>DESCRIPTION</th>
    				<th>ETAT D’AVANCEMENT	</th>
    				<th>RESPONSABLE </th>
    				<th>ETAT </th>
    				<th>MODIFIER</th>
    				<th>SUPPRIMER</th>
    				</tr>';
     
    			try
    			{
     
     
    		$date1 = $_POST['date1'];
    		$date2 = $_POST['date2'];
    			 $reponse = $bdd->query("SELECT 
    	 a.id_rah,
         a.datejour,
    	 a.projets_taches,
    	 a.description,
    	 a.avancement,
    	 a.entite_responsable,
    	 a.etat_tache
         FROM 
         rah a
    	 where datejour between '$date1' and '$date2' and
    	 etat_tache = 'Conclue' order by a.datejour");
     
    			while ($donnees = $reponse->fetch())
    			{
    				$i++;
    				echo '<tr>';
    					echo '
    					
    					<td><input type="checkbox" name="checkbox[]" value ="'.$donnees['id_rah'].'" /></td>
    					<td>'. $donnees['datejour'].'</td>
    					<td>'. $donnees['projets_taches'].'</td>
    					<td>'. $donnees['description'].'</td>
    					<td>'. $donnees['avancement'].'</td>
    					<td>'. $donnees['entite_responsable'].'</td>
    					<td>'. $donnees['etat_tache'].'</td>';
    					echo'<td><a href="modifier_rah.php?modifier='.$donnees['id_rah'].'">Modifier</a></td>';
    					echo'<td><a href="confirmation_sup_rah.php?supprimer='.$donnees['id_rah'].'"><img src="images/supprimer.jpg"></a></td>';
    				echo '</tr>';
    			}
    			}
    			catch(Exception $e)
                {
                     die('Erreur : '.$e->getMessage());
                }
     
    			   }
     
     
    			 echo '</table>';
    			 echo '</form>';
    			 echo '<div id="form2">';
    			 echo '<form method="POST" action="consultation_rah.php" name="consultation_rah" >';
    			 echo ' <br/> <br/> <br/>';
    			 echo '<fieldset id="consul_ram" style="width:360px;">';
    			 echo ' <legend><strong>OPTIONS</strong></legend> ';
    			 echo '<p>';
    			 echo '<input type="submit" name="generer_ram" id="generer_ram" value="RAM" /> ';
    			 echo ' <input type="submit" name="Annuler" id="Annuler" value="Annuler" />  ';
    			 echo ' </p>';
    			 echo '</fieldset> <br/>';
    			 echo '</form>	';
    			 echo '</div >';
    			 }
    /******************************************************************************************************************************/
                   /**************** Traitement du RAM *************************************/
     
    var_dump($_POST['checkbox']);
    if (isset($_POST['generer_ram'])  && !empty($_POST['checkbox']))
    	           {
     
    			    $checkbox = array($_POST['checkbox']);
     
    			     echo '<form>';
    				 echo '<table>';
    				 echo '<tr>
    				<th>DATE </th>
    				<th>PROJETS / TÂCHES</th>
    				<th>DESCRIPTION</th>
    				<th>ETAT D’AVANCEMENT</th>
    				<th>RESPONSABLE </th>
    				<th>ETAT </th>
    				</tr>';
     
                     $tabCheckbox = array($_POST['checkbox']);
                     foreach ($tabCheckbox as $checkbox) 
    				 {
                     $checkbox = htmlspecialchars($checkbox);
                     $reponse = $bdd->query("SELECT 
    	             a.id_rah,
    				 a.datejour,
    				 a.projets_taches,
    				 a.description,
    				 a.avancement,
    				 a.entite_responsable,
    				 a.etat_tache
    				 FROM 
    				 rah a 
    				 where a.datejour = '$checkbox' order by a.datejour");
     
    				$donnees = $reponse->fetch();
    				$i++;
    				echo '<tr>';
    					echo '
    					<td>'. $donnees['datejour'].'</td>
    					<td>'. $donnees['projets_taches'].'</td>
    					<td>'. $donnees['description'].'</td>
    					<td>'. $donnees['avancement'].'</td>
    					<td>'. $donnees['entite_responsable'].'</td>
    					<td>'. $donnees['etat_tache'].'</td>';
    				echo '</tr>';
     
     
                   }
    			   echo '</table>';
    			   echo '</form>';
     
           }
        else
    	  { 
    	     //echo "<script langage='javascript'>alert('Faites le choix d'une tache dans le RAH ...');</script>";
             //echo "Faites le choix d'une tache dans le RAH ...";
    		 //redirect('consultation_rah.php'); 
    	  }
     
     ?>

  4. #4
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Points : 16 372
    Points
    16 372
    Par défaut
    Je vais expliciter un peu le message de JReaux : si tu veux utiliser des checkboxes, il te faut un formulaire et si tu veux envoyer un formulaire, il te faut un bouton submit (ou un javascript qui fait la même chose)

    Là, tu as uniquement un lien, donc les seules informations que tu vas recevoir seront celles directement dans le lien.
    Modératrice PHP
    Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)
    Cherchez un peu avant poser votre question : Cours et Tutoriels PHP - FAQ PHP - PDO une soupe et au lit !.

    Affichez votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur) et [C=php][/C]

Discussions similaires

  1. [AJAX] récupérer données transmises par php
    Par Maryy dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 07/01/2007, 16h07
  2. Valeur renvoyée par interrupteur (check box)
    Par nath-0-0 dans le forum WinDev
    Réponses: 8
    Dernier message: 29/11/2006, 16h33
  3. [PHP/MySQL]Récupérer un fichier par blob
    Par Justo dans le forum SQL Procédural
    Réponses: 2
    Dernier message: 05/07/2006, 14h36
  4. [MySQL] Récupérer Code HTML généré par PHP
    Par @ngelofdeath dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 26/04/2006, 21h51
  5. [PHP-JS] controler la nom selection de 2 check box
    Par amarcil dans le forum Langage
    Réponses: 10
    Dernier message: 07/04/2006, 20h27

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo