185 lines
4.9 KiB
PHP
Executable File
185 lines
4.9 KiB
PHP
Executable File
<?php
|
|
session_start();
|
|
$idcateg=$HTTP_GET_VARS["idcateg"];
|
|
?>
|
|
<html>
|
|
<head>
|
|
<title>Partie Administrateur</title>
|
|
</head>
|
|
<body>
|
|
<div align="center">
|
|
<table border=1>
|
|
<tr>
|
|
<td colspan=2 align="center">
|
|
<h1>Site Marchand Airtria</h1>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2 align="center">
|
|
<br><br><h1>Gestion des produits</h1>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
if (isset($_SESSION['idadm']))
|
|
{
|
|
|
|
require("../connexion.php");
|
|
$conn = mysql_connect($host, $user, $password);
|
|
mysql_select_db($bdd) or die("Impossible d'ouvrir la base de donnee $bdd");
|
|
|
|
/* Affichage donnees de la categ */
|
|
$requete1 = "select idcateg,nomcateg,descriptioncateg from categorie where idcateg='$idcateg'";
|
|
$result1=mysql_query($requete1) or die ("Erreur SQL :$requete<br>".mysql_error()."...");
|
|
|
|
/* Affichage des familles associees a la categ */
|
|
$requete2 = "select idfamille,nomfamille,descriptionfamille from famille where idcateg='$idcateg'";
|
|
$result2=mysql_query($requete2) or die ("Erreur SQL :$requete<br>".mysql_error()."...");
|
|
|
|
?>
|
|
<table>
|
|
<tr>
|
|
<td align="center">
|
|
<br><br> <b>Categorie</b><br> 
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
while ($ligne=mysql_fetch_row($result1))
|
|
{
|
|
$idcateg=$ligne[0];
|
|
$nomcateg=$ligne[1];
|
|
$descriptioncateg=$ligne[2];
|
|
}
|
|
?>
|
|
<tr>
|
|
<td>
|
|
<form name="f1" action="updatecateg.php" method="POST">
|
|
<table>
|
|
<tr align='center'>
|
|
<td colspan=2>
|
|
<input type="text" name="nomcateg" value="<?php print $nomcateg?>"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2>
|
|
<textarea name="descriptioncateg" cols="50" rows="10"><?php print $descriptioncateg?></textarea>
|
|
<input type="hidden" name="<?php print session_name()?>" value="<?php print session_id()?>"/>
|
|
<input type="hidden" name="idcateg" value="<?php print $idcateg?>"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2 align=center>
|
|
<input type="submit" value="Modifier"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<table>
|
|
<form name="ajoutfamille" action="ajoutfamille.php" method="POST">
|
|
<tr align="center">
|
|
<td align="right">
|
|
Nom :
|
|
</td>
|
|
<td>
|
|
<input type=text name="nomfam"/>
|
|
</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td align="right">
|
|
Description :
|
|
</td>
|
|
<td>
|
|
<textarea name="desc"></textarea>
|
|
<input type="hidden" name="ajoutfam" value="go"/>
|
|
<input type="hidden" name="idcateg" value="<?php print $idcateg ?>"/>
|
|
<input type="hidden" name="<?php print session_name() ?>" value="<?php print session_id()?>"/>
|
|
</td>
|
|
</tr>
|
|
<tr align="center">
|
|
<td colspan=2>
|
|
<input type="submit" value="inserer"/>
|
|
<td>
|
|
</tr>
|
|
</form>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<table border=1>
|
|
<tr>
|
|
<td colspan=3 align="center">
|
|
<b>Liste des familles associees</b><br> 
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
<table border=1>
|
|
<tr bgcolor=#FFFFFF align="center">
|
|
<td>
|
|
<b>ID Famille</b>
|
|
</td>
|
|
<td>
|
|
<b>Nom famille</b>
|
|
</td>
|
|
<td colspan=2>
|
|
<b>Description</b>
|
|
</td>
|
|
</tr>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
|
|
while ($ligne=mysql_fetch_row($result2))
|
|
{
|
|
$idfamille=$ligne[0];
|
|
$nomfamille=$ligne[1];
|
|
$descriptionfamille=$ligne[2];
|
|
?>
|
|
<tr align='center'>
|
|
<form name="supfamil" action="supfamille.php" method="POST">
|
|
<td>
|
|
<?php print $idfamille?>
|
|
</td>
|
|
<td>
|
|
<a href="famille.php?idcateg=<?php print $idcateg?>&idfamille=<?php print $idfamille?>"><?php print $nomfamille?></a>
|
|
</td>
|
|
<td>
|
|
<?php print $descriptionfamille?>
|
|
<input type="hidden" name="idfamille" value="<?php print $idfamille?>"/>
|
|
<input type="hidden" name="idcateg" value="<?php print $idcateg?>"/>
|
|
</td>
|
|
<td>
|
|
<input type="submit" value="supprimer"/>
|
|
</td>
|
|
</form>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br><a href="produit.php?loguer=oui&<?php print session_name();?>=<?php print session_id();?>">Retour</a>
|
|
</div>
|
|
<?php
|
|
}
|
|
else
|
|
{
|
|
print "Erreur de connection";
|
|
}
|
|
?>
|
|
|
|
</body>
|
|
</html>
|