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 :

Problème d'affichage recherche avec checkbox


Sujet :

Langage PHP

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 22
    Points : 6
    Points
    6
    Par défaut Problème d'affichage recherche avec checkbox
    Bonjour, voilà je suis sur un problème que je n'arrive pas à résoudre,

    je souhaite afficher grâce à un formulaire donner l'élément à rechercher ainsi une validation par checkbox pour activer la fonction et donc afficher les information nécessaires.

    Je vous montre le code
    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
     
    <html>
    <center>
    <br></br>
    <form method="POST" action=""> 
    Marteau : <input type="text" name="Marteautest">
    <br></br>
    <input type="checkbox" name="magasin" id="magasin"/>verifier magasin</br>
    <input type="checkbox" name="stock" id="stock"/>verifier stock</br>
    <input type="SUBMIT" value="Recherche"> 
    </center>
    <br></br>
     
    <?php
    if (isset($_POST['magasin']))	
    {
    ?>
    	<center>
    	<font face="Verdana" size="1">
    	</font>
     
    	<table border="0" cellpadding="0" cellspacing="0" width="80%" id="table1">
    	  <tr>
     
    	  	<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Peinture</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Perceuse</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Vis</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Planche</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Marteau</font></b></td>
     
    	  </tr>
    	</center>
    <?php
    include('../user_verif.php');
     
        $Marteautest = isset($_POST['Marteautest']) ? $_POST['Marteautest'] : '';
     
    	//Connexion à la Base de donnée
     
    	$sql->open();
     
    	//Requête SQL
     
    	$result = $sql->query("Select * From Magasin Where Marteau = '$Marteautest' order by Marque ASC");
     
    	//Extraction et traitement
     
    	while( $row = mysql_fetch_array( $result ) )
    	{
     
    		$Peinture = nl2br ( $row['Peinture '] );
     
    		$Perceuse = nl2br ( $row['Perceuse '] );
     
    		$Vis= nl2br ( $row['Vis'] );
     
    		$Planche= nl2br ( $row['Planche'] );
     
    		$Marteau= nl2br ( $row['Marteau'] );
     
    	    echo '<center><tr>
    		<td  align="center" style="border-left: 1px solid #000000; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Peinture.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Perceuse.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Vis.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Planche.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Marteau.'</font></td>
    		
    	</tr></center>';
     
    	}
     
    //Fin du tableau
     
    ?>
    	<center>
    	  <tr>
    		<td style="border-left: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    	  </tr>
    	</table>
    	</center>
    	</div>
     
      </body>
     
      </html>
     
    <?php
     
      //On ferme la connexion SQL
     
      $sql->close();
     
      exit;
     
    ?>
    }
     
    <?php
    if (isset($_POST['stock']))	
    {	
    ?>
    	<font face="Verdana" size="1">
    	</font>
    	<center>
    	<table border="0" cellpadding="0" cellspacing="0" width="80%" id="table1">
    	  <tr>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Planche</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Marteau</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Clou</font></b></td>
    	  </tr>
    	</center>
    </form>
    </html>	  
     
    <?php
    include('../user_verif.php');
     
        $BAStest = isset($_POST['Marteautest']) ? $_POST['Marteautest'] : '';
     
    	//Connexion à la Base de donnée
     
    	$sql->open();
     
    	//Requête SQL
     
    	$result = $sql->query("Select * From stock Where marteau = '$Marteautest' and order by Marque ASC");
     
    	//Extraction et traitement
     
    	while( $row = mysql_fetch_array( $result ) )
    	{
    		  $Planche= nl2br ( $row['Planche'] );
     
    		  $Marteau= nl2br ( $row['Marteau'] );
     
    		  $Clou= nl2br ( $row['Clou'] );
     
    	    echo '<tr><center>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Planche.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Marteau.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Clou.'</font></td>
    		</center>
    	</tr>';
     
    	}
     
    //Fin du tableau
     
    ?>
    	<center>
    	  <tr>
    		<td style="border-left: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    	  </tr>
    	</table>
    	</center>
    	</div>
     
      </body>
     
      </html>
     
    <?php
     
      //On ferme la connexion SQL
     
      $sql->close();
     
      exit;
    ?>	
    }

  2. #2
    Membre actif Avatar de Retrokiller069
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2010
    Messages
    217
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2010
    Messages : 217
    Points : 296
    Points
    296
    Par défaut
    Bonjour,

    je suis un chiant je le reconnais avec ca mais peux tu remplacer <? par <?php car j'ai vu que tu le faisais par endroit mais pas partout.

    Est ce que c'est normal que ton action ne soit pas renseigner (dans ton form), normalement il comporte l'accés vers la page suivante?

    ici je dirais au vue de ton code que c'est le nom de ta page ^^

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 22
    Points : 6
    Points
    6
    Par défaut
    Bonjour Retrokiller069,

    Je viens de mettre à jour les deux champs <? par <?php

    Disons que pour le moment je faisais le test en interne de la page donc j'ai pas référencer la nouvelle page vu que c'est la même. (Après c'est peut-être une faute ?)

  4. #4
    Membre actif Avatar de Retrokiller069
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2010
    Messages
    217
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2010
    Messages : 217
    Points : 296
    Points
    296
    Par défaut
    Bonjour,

    oui c'est une erreur car en fait si le form n'a pas d'action dans ce cas il ne va nul part mais ne réactualise pas la page non plus puisqu'on lui dit pas.

    tu dois juste mettre le nom de page sur laquelle tu veux aller même si c'est la même page.

  5. #5
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 22
    Points : 6
    Points
    6
    Par défaut
    Cela change rien au problème il garde toujours la première partie du code et n'affiche pas la deuxième partie quoi qu'il arrive

  6. #6
    Membre confirmé
    Avatar de Nowwis
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2009
    Messages
    406
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Somme (Picardie)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juin 2009
    Messages : 406
    Points : 498
    Points
    498
    Par défaut
    Essaie de mettre une value à la checkbox, genre value="1" et fais

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    if(isset($_POST['magasin']) && $_POST['magasin'] == 1)
    {
       ...
    }

  7. #7
    Membre actif Avatar de Retrokiller069
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2010
    Messages
    217
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2010
    Messages : 217
    Points : 296
    Points
    296
    Par défaut
    pardon j'avais pas bien regarder ton code, tu ne dois pas faire que test si la varibale existe (car elle existe toujours dans ton cas) tu dois également regarder sa valeur.

    il me semble (mais tu peux regarder ca facilement) que la valeur d'un checkbox c'est "on" si il l'est sélectionné.

    ce qui donne:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if(isset($_POST['magasin']) && $_POST['magasin']=="on")
    si le problème persiste, affiche (avec un echo) la valeur de ton $_POST['magasin'] avant son test et regarde ca valeur lorsqu'il est sélectionner et remplace le "on" par la valeur que tu as.

    en espérant que ca marche

  8. #8
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 22
    Points : 6
    Points
    6
    Par défaut
    Bonjour, encore merci de vos réponse rapide, mais malheureusement , cela ne marche pas

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <?
    echo $_POST['magasin'];
    echo $_POST['stock'];
    echo "123";
    echo $_POST['Marteautest'];
    if (isset($_POST['magasin']) && $_POST['magasin'] == 1 )	
    {
    ?>
    Je n'ai aucune réponse qui me sort de mes échos comme si il existait pas.

    Et malgré tout c'est toujours le premier code qui s'affiche si jamais j'inverse les codes que ce soit magasin en deuxième et stock en premier je verrais toujours le premier

  9. #9
    Membre confirmé
    Avatar de Nowwis
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2009
    Messages
    406
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Somme (Picardie)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juin 2009
    Messages : 406
    Points : 498
    Points
    498
    Par défaut
    Où as-tu mis ces "echo" ?

    Essaie ce code et donne nous la réponse :

    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
    <html>
    <center>
    <?php
    echo "Magasin : ".$_POST['magasin'];
    echo "Stock: ".$_POST['stock'];
    echo "Test : 123";
     
    ?>
    <br></br>
    <form method="POST" action=""> 
    Marteau : <input type="text" name="Marteautest">
    <br></br>
    <input type="checkbox" value="1" name="magasin" id="magasin" />verifier magasin</br>
    <input type="checkbox" value="1" name="stock" id="stock" />verifier stock</br>
    <input type="SUBMIT" value="Recherche"> 
    </center>
    <br></br>
     
    <?php
    if (isset($_POST['magasin']) && $_POST['magasin'] == 1 )
    {
    ?>
    	<center>
    	<font face="Verdana" size="1">
    	</font>
     
    	<table border="0" cellpadding="0" cellspacing="0" width="80%" id="table1">
    	  <tr>
     
    	  	<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Peinture</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Perceuse</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Vis</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Planche</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Marteau</font></b></td>
     
    	  </tr>
    	</center>
    <?php
    include('../user_verif.php');
     
        $Marteautest = isset($_POST['Marteautest']) ? $_POST['Marteautest'] : '';
     
    	//Connexion à la Base de donnée
     
    	$sql->open();
     
    	//Requête SQL
     
    	$result = $sql->query("Select * From Magasin Where Marteau = '$Marteautest' order by Marque ASC");
     
    	//Extraction et traitement
     
    	while( $row = mysql_fetch_array( $result ) )
    	{
     
    		$Peinture = nl2br ( $row['Peinture '] );
     
    		$Perceuse = nl2br ( $row['Perceuse '] );
     
    		$Vis= nl2br ( $row['Vis'] );
     
    		$Planche= nl2br ( $row['Planche'] );
     
    		$Marteau= nl2br ( $row['Marteau'] );
     
    	    echo '<center><tr>
    		<td  align="center" style="border-left: 1px solid #000000; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Peinture.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Perceuse.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Vis.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Planche.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Marteau.'</font></td>
     
    	</tr></center>';
     
    	}
     
    //Fin du tableau
     
    ?>
    	<center>
    	  <tr>
    		<td style="border-left: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    	  </tr>
    	</table>
    	</center>
    	</div>
     
      </body>
     
      </html>
     
    <?php
     
      //On ferme la connexion SQL
     
      $sql->close();
     
      exit;
     
    ?>
    }
     
    <?php
    if (isset($_POST['stock']))	
    {	
    ?>
    	<font face="Verdana" size="1">
    	</font>
    	<center>
    	<table border="0" cellpadding="0" cellspacing="0" width="80%" id="table1">
    	  <tr>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Planche</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Marteau</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Clou</font></b></td>
    	  </tr>
    	</center>
    </form>
    </html>	  
     
    <?php
    include('../user_verif.php');
     
        $BAStest = isset($_POST['Marteautest']) ? $_POST['Marteautest'] : '';
     
    	//Connexion à la Base de donnée
     
    	$sql->open();
     
    	//Requête SQL
     
    	$result = $sql->query("Select * From stock Where marteau = '$Marteautest' and order by Marque ASC");
     
    	//Extraction et traitement
     
    	while( $row = mysql_fetch_array( $result ) )
    	{
    		  $Planche= nl2br ( $row['Planche'] );
     
    		  $Marteau= nl2br ( $row['Marteau'] );
     
    		  $Clou= nl2br ( $row['Clou'] );
     
    	    echo '<tr><center>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Planche.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Marteau.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Clou.'</font></td>
    		</center>
    	</tr>';
     
    	}
     
    //Fin du tableau
     
    ?>
    	<center>
    	  <tr>
    		<td style="border-left: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    	  </tr>
    	</table>
    	</center>
    	</div>
     
      </body>
     
      </html>
     
    <?php
     
      //On ferme la connexion SQL
     
      $sql->close();
     
      exit;
    ?>	
    }

  10. #10
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 22
    Points : 6
    Points
    6
    Par défaut
    Il m'affiche

    "Parse error: parse error in C:\wampserver\www\CIRIS\admin\Bas2.php on line 196"

    Donc il pointe sur la dernière accolade

  11. #11
    Membre confirmé
    Avatar de Nowwis
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2009
    Messages
    406
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : France, Somme (Picardie)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juin 2009
    Messages : 406
    Points : 498
    Points
    498
    Par défaut
    Raah c'est juste un if qui est pas fermé, je te mets le code mais essaie de trouver cette simple erreur la prochaine fois... On ne connait pas forcément l'architecture de ton code donc quand tu vois du parse error c'est une accolade ou un ; qui manque...
    Si jamais ça ne marche pas, essaie de vérifier

    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
    <html>
    <center>
    <?php
    echo "Magasin : ".$_POST['magasin'];
    echo "Stock: ".$_POST['stock'];
    echo "Test : 123";
     
    ?>
    <br></br>
    <form method="POST" action=""> 
    Marteau : <input type="text" name="Marteautest">
    <br></br>
    <input type="checkbox" value="1" name="magasin" id="magasin" />verifier magasin</br>
    <input type="checkbox" value="1" name="stock" id="stock" />verifier stock</br>
    <input type="SUBMIT" value="Recherche"> 
    </center>
    <br></br>
     
    <?php
    if (isset($_POST['magasin']) && $_POST['magasin'] == 1 )
    {
    ?>
    	<center>
    	<font face="Verdana" size="1">
    	</font>
     
    	<table border="0" cellpadding="0" cellspacing="0" width="80%" id="table1">
    	  <tr>
     
    	  	<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Peinture</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Perceuse</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Vis</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Planche</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Marteau</font></b></td>
     
    	  </tr>
    	</center>
    <?php
    include('../user_verif.php');
     
        $Marteautest = isset($_POST['Marteautest']) ? $_POST['Marteautest'] : '';
     
    	//Connexion à la Base de donnée
     
    	$sql->open();
     
    	//Requête SQL
     
    	$result = $sql->query("Select * From Magasin Where Marteau = '$Marteautest' order by Marque ASC");
     
    	//Extraction et traitement
     
    	while( $row = mysql_fetch_array( $result ) )
    	{
     
    		$Peinture = nl2br ( $row['Peinture '] );
     
    		$Perceuse = nl2br ( $row['Perceuse '] );
     
    		$Vis= nl2br ( $row['Vis'] );
     
    		$Planche= nl2br ( $row['Planche'] );
     
    		$Marteau= nl2br ( $row['Marteau'] );
     
    	    echo '<center><tr>
    		<td  align="center" style="border-left: 1px solid #000000; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Peinture.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Perceuse.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Vis.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Planche.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Marteau.'</font></td>
     
    	</tr></center>';
     
    	}
     
    //Fin du tableau
     
    ?>
    	<center>
    	  <tr>
    		<td style="border-left: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    	  </tr>
    	</table>
    	</center>
    	</div>
     
      </body>
     
      </html>
     
    <?php
     
      //On ferme la connexion SQL
     
      $sql->close();
     
      exit;
     
    ?>
    }
     
    <?php
    if (isset($_POST['stock']))	
    {	
    ?>
    	<font face="Verdana" size="1">
    	</font>
    	<center>
    	<table border="0" cellpadding="0" cellspacing="0" width="80%" id="table1">
    	  <tr>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Planche</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Marteau</font></b></td>
     
    		<td style="border-left-style: dotted; border-left-width: 1px; border-top: 1px solid #000000" bgcolor="#81ABD1" align="center" width="100">
    		<b><font face="Verdana" size="2">Clou</font></b></td>
    	  </tr>
    	</center>
    </form>
    </html>	  
     
    <?php
    include('../user_verif.php');
     
        $BAStest = isset($_POST['Marteautest']) ? $_POST['Marteautest'] : '';
     
    	//Connexion à la Base de donnée
     
    	$sql->open();
     
    	//Requête SQL
     
    	$result = $sql->query("Select * From stock Where marteau = '$Marteautest' and order by Marque ASC");
     
    	//Extraction et traitement
     
    	while( $row = mysql_fetch_array( $result ) )
    	{
    		  $Planche= nl2br ( $row['Planche'] );
     
    		  $Marteau= nl2br ( $row['Marteau'] );
     
    		  $Clou= nl2br ( $row['Clou'] );
     
    	    echo '<tr><center>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Planche.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Marteau.'</font></td>
    		<td  align="center" style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #DBE7F2" bgcolor="#FFFFFF"><font face="Verdana" size="2">'.$Clou.'</font></td>
    		</center>
    	</tr>';
     
    	}
     
    //Fin du tableau
     
    ?>
    	<center>
    	  <tr>
    		<td style="border-left: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    		<td style="border-left-style: dotted; border-left-width: 1px; border-right: 1px solid #000000; border-bottom: 1px solid #000000" bgcolor="#FFFFFF">&nbsp;</td>
    	  </tr>
    	</table>
    	</center>
    	</div>
     
      </body>
     
      </html>
     
    <?php
      //On ferme la connexion SQL
     
      $sql->close();
     
      exit;
    }
    ?>

  12. #12
    Membre actif Avatar de Retrokiller069
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2010
    Messages
    217
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2010
    Messages : 217
    Points : 296
    Points
    296
    Par défaut
    lol j'ai mis du temps à le voir mais il y a une erreur, tes { doivent être dans la partie php et non dans la partie html ^^

    ps: c'est pareil pour la ligne 114 ^^

  13. #13
    Futur Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 22
    Points : 6
    Points
    6
    Par défaut
    Merci les gars vous êtes géniaux :p

Discussions similaires

  1. Problème d'envoi formulaire avec checkboxes
    Par neospirit dans le forum Langage
    Réponses: 3
    Dernier message: 19/04/2011, 11h14
  2. Problème dans un panel avec checkbox
    Par Zaza91280 dans le forum VB.NET
    Réponses: 6
    Dernier message: 10/04/2010, 19h13
  3. Prob affichage recherche avec Tkinter
    Par steph70 dans le forum Tkinter
    Réponses: 20
    Dernier message: 09/10/2009, 07h00
  4. [MySQL] Problème d'affichage résultat avec un fetch_array
    Par Arkoze dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 28/12/2007, 13h21
  5. [Tableaux] problème d'affichage de mes checkbox
    Par parko dans le forum Langage
    Réponses: 11
    Dernier message: 04/09/2007, 10h32

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