par
chidap » 22 mars 2013, 18:14
Bonjour je suis nouveau et je vais chercher de l'aide parmis vous.
Merci,
j'ai un formulaire qui doit lister trois champs tous d'une même table avec deux conditions à remplir:
Code : Tout sélectionner
[html]
<head><title>formulaire</title>
<body>
<form action="liste_libre.php" method="post" >
<table width="800" height="38" border="1" align="center" bordercolor="#FF9933" bgcolor="#F4C89F">
<tr>
<td width="415" align="right">LISTER LES PANNEAUX LIBRES </td>
<td colspan="2"></td>
</tr>
<tr>
<td align="right"><span>Selectionner la ville : </span></td>
<td width="127"><select name="ville" id="ville">
<option value="soweto" selected="selected">soweto</option>
<option value="alger">alger</option>
<option value="lisbonne">lisbonne</option>
<option value="paris">paris</option>
<option value="camberra">camberra</option>
<option value="kyoto">kyoto</option>
</select> </td>
<td width="208"><input type="submit" name="button2" id="button2" value="Editer" /></td>
</tr>
</body>
</head>
[/html]
Maintenant mon fichier action c'est = liste_libre.php
<head><title>formulaire</title>
<body>
<?php
include ("connexion.php");
?>
<table border="1" width="800" cellspacing="0" class="" align="center">
<tr bgcolor="#999999">
<td>[sql]
<?php
$req="SELECT format, emplacement, support, nombre_de_face FROM $T_panneaux WHERE etat='libre'";[/sql]
[php] $res=mysql_query($req);
while($T_panneaux=mysql_fetch_array($res)){
$ville=$_POST["ville"];
$format=$T_panneaux["format"];
$emplacement=$T_panneaux["emplacement"];
$support=$T_panneaux["support"];
$nombre_de_face=$T_panneaux["nombre_de_face"];
if($ville==""){
echo "<table width='800' border='1' cellspacing='0'>
<tr>
<td>format</td>
<td>emplacement</td>
<td>support</td>
<td>nombre_de_face</td>
</tr>" ;
}
$format=$T_panneaux["format"];
$emplacement=$T_panneaux["emplacement"];
$support=$T_panneaux["support"];
$nombre_de_face=$T_panneaux["nombre_de_face"];
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="soweto"){
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="alger"){
echo "<tr>
<td>$req</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="paris"){
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="camberra"){
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="kyoto"){
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
[/php]
</body>
</head>
Malheureusement pour moi, quand je liste le programme me liste tous les sites sans tenir compte des villes, il prend tous les emplacements libres sans tenir compte de la condition de la ville.
qui pourrais m'aider avec un bon code s'il vous plait ???
Bonjour je suis nouveau et je vais chercher de l'aide parmis vous.
Merci,
j'ai un formulaire qui doit lister trois champs tous d'une même table avec deux conditions à remplir:
[code]
[html]
<head><title>formulaire</title>
<body>
<form action="liste_libre.php" method="post" >
<table width="800" height="38" border="1" align="center" bordercolor="#FF9933" bgcolor="#F4C89F">
<tr>
<td width="415" align="right">LISTER LES PANNEAUX LIBRES </td>
<td colspan="2"></td>
</tr>
<tr>
<td align="right"><span>Selectionner la ville : </span></td>
<td width="127"><select name="ville" id="ville">
<option value="soweto" selected="selected">soweto</option>
<option value="alger">alger</option>
<option value="lisbonne">lisbonne</option>
<option value="paris">paris</option>
<option value="camberra">camberra</option>
<option value="kyoto">kyoto</option>
</select> </td>
<td width="208"><input type="submit" name="button2" id="button2" value="Editer" /></td>
</tr>
</body>
</head>
[/html]
[/code]
Maintenant mon fichier action c'est = liste_libre.php
[html]
<head><title>formulaire</title>
<body>
<?php
include ("connexion.php");
?>
<table border="1" width="800" cellspacing="0" class="" align="center">
<tr bgcolor="#999999">
<td>[sql]
<?php
$req="SELECT format, emplacement, support, nombre_de_face FROM $T_panneaux WHERE etat='libre'";[/sql]
[php] $res=mysql_query($req);
while($T_panneaux=mysql_fetch_array($res)){
$ville=$_POST["ville"];
$format=$T_panneaux["format"];
$emplacement=$T_panneaux["emplacement"];
$support=$T_panneaux["support"];
$nombre_de_face=$T_panneaux["nombre_de_face"];
if($ville==""){
echo "<table width='800' border='1' cellspacing='0'>
<tr>
<td>format</td>
<td>emplacement</td>
<td>support</td>
<td>nombre_de_face</td>
</tr>" ;
}
$format=$T_panneaux["format"];
$emplacement=$T_panneaux["emplacement"];
$support=$T_panneaux["support"];
$nombre_de_face=$T_panneaux["nombre_de_face"];
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="soweto"){
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="alger"){
echo "<tr>
<td>$req</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="paris"){
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="camberra"){
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
if($ville=="kyoto"){
echo "<tr>
<td>$format</td>
<td>$emplacement</td>
<td>$support</td>
<td>$nombre_de_face</td>
</tr>";
}
[/php]
</body>
</head>
[/html]
Malheureusement pour moi, quand je liste le programme me liste tous les sites sans tenir compte des villes, il prend tous les emplacements libres sans tenir compte de la condition de la ville.
qui pourrais m'aider avec un bon code s'il vous plait ???