-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsultcat.php
43 lines (36 loc) · 1.25 KB
/
consultcat.php
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
<center>
<fieldset><legend>Consulter une categorie</legend>
<form method="post" action="index.php?p=consultcat">
<select name="categorie">
<?php $req = mysql_query("SELECT nomtype FROM typebien");
while ($donnees = mysql_fetch_array($req))
{?>
<option value="<?php echo $donnees['nomtype']; ?>"<?php
if ((isset($_POST["categorie"])) AND ($_POST["categorie"] == $donnees['nomtype']))
{echo "selected";}?> > <?php echo $donnees['nomtype']; ?>
</option>
<?php }?>
</select>
<input type="submit" value="Afficher" />
</form>
</fieldset>
<?php
if ((isset($_POST["categorie"])))
{
?>
<table><caption><?php echo $_POST["categorie"];?></caption>
<tr>
<th>Nom du bien</th>
<th>Photo</th>
</tr>
<?php $req = mysql_query("SELECT b.idbien, b.titrebien, b.photobien FROM bien b, typebien t WHERE b.idtype=t.idtype AND t.nomtype IN(SELECT nomtype from typebien where nomtype= '" .$_POST['categorie']. "' ) ");
while ($donnees = mysql_fetch_array($req))
{?>
<tr>
<td><?php echo $donnees['titrebien']; ?></td>
<td><a href="index.php?p=detailbien&idbien=<?php echo $donnees['idbien'];?>"><img src="images/<?php echo $donnees['photobien']; ?>" ></a></td>
</tr>
<?php }?>
</table><?php
}
?></center>