Bonjour
je bloque depuis deux jours sur une partie qui est comme suit
en fait je souhaite faire une requete SQL (en PDO) dans laquelle je saisie des conditions
mon scénario est le suivant un utilisateur peut entrer un nom de service et si il veut faire la recherche selon ceci il coche la case il peut entrer un autre champs et cocher cet autre champs comme il peut entrer les deux et cochez les 2 voila le code du formulaire:
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
26
27
<form action="recherche.php" method="POST">
<fieldset>
    <legend>Partie Nord</legend> <!-- Titre du fieldset --> 
<div class="control-group">
 <label class="control-label" for="Service">Service</label>
 <div class="controls">
<input id="logServiceCheckbox" name="logServiceCheckbox" type="checkbox">
<input id="logService" name="logService" type="text" placeholder="service" class="input-xlarge">
 </div>
</div>
<!-- Select Basic -->
<div class="control-group">
 <label class="control-label" for="Pays">Pays</label>
 <div class="controls">
<input id="logPaysCheckbox" name="logPaysCheckbox" type="checkbox">
<select id="logPays" name="logPays" class="input-xlarge">
 <option value="">choix</option>
 <option value="TN">Tunisie</option>
 <option value="FR">France</option>
</select>
</div>
</label>
</div>
<div class="form-actions" align="right">
       <button type="submit" class="btn btn-success">Rechercher</button>
</div>
</form>
et la page a la quelle on me fais dirriger est la suivante
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
<?php
include ("connexion.php"); 
$req='select* from service where 1';
if (logServiceCheckbox==True)
$req.=' and nom_service='$logService'';
if (logPaysCheckbox==True)
$req.=' and pays='$logPays'';
$connexion->exec($req);
$number=$connexion->rowCount();
if ($number==1){
$resultat=$connexion->fetch(PDO::FETCH_ASSOC);
$protocole=$resultat->prot;
$MO=$resultat->mo;
header("location:index.php?protocole=$protocole;MO=$MO");
echo "Bravo le script marche";}
else {
echo "non non รงa ne marche pas "
?>
<table id="example" class="display table table-striped table-bordered"  cellspacing="0" width="100%"  >
    <thead>
	<tr>
		<th>Nom Service</th>
		<th>SID</th>
		<th>Short-Code</th>
		<th>Pays</th>
		<th>Flux MO</th>
		<th>Flux MT</th>
		<th>DR</th>
		<th>Protocole</th>
		<th>Login </th>
		<th>Mot de Passe</th>
		<th>Version</th>
		<th>Type d'acces</th>
		<th>Adresse IP </th>
		<th>Port</th>
		<th>URL-IOSW</th>
		<th>URL-MO</th>
		<th>URL-DR</th>
		<th>Date Demande</th>
		<th>Date Production</th>
		<th>Contact:Nom</th>
		<th>Contact:Prenom </th>
		<th>Contact:Tel</th>
		<th>Contact:Email</th>
	</tr>
</thead>
<tbody>
<?php
while( $resultat= $connexion->fetch() ){
?>
	<tr>
		<td> <?php echo ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->nom_service;?></td>
		<td><?php echo ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->sid;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->sc;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->pays;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->MO;?></td>
		<td><?php echo ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php  $resultat->MT;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->DR;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->prot;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->login;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->password;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->version;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->acces;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->adresseip;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->port;?></td>
		<td><?php echo ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php  $resultat->url_iosw;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->url_mo;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->url_dr;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->date_demande;?></td>
		<td><?php echo ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php  $resultat->date_prod;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->nom;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->prenom;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->tel;?></td>
		<td><?php echo  ?>  <a href= "index.php ?protocole=$protocole;MO=$MO"><?php $resultat->email;?></td>
	</tr>
<?php
} 
?>
</tbody>
</table>
<?php }
?>
je bloque au niveau de la requete sql parce que l'erreur qui m'affiche est la suivante :
Notice: Undefined variable: connexion
Fatal error: Call to a member function exec() on a non-object in
SVP j'ai vraiment besoin d'avancer et je bloque deouis 2 jours sur ce point je serai trés reconnaissante pour votre aide