196 lines
5.3 KiB
PHP
Executable File
196 lines
5.3 KiB
PHP
Executable File
<?php
|
|
session_start();
|
|
$loguer=$HTTP_GET_VARS["loguer"];
|
|
$idfamille=$HTTP_GET_VARS["idfamille"];
|
|
$idcateg=$HTTP_GET_VARS["idcateg"];
|
|
$nomcateg=$HTTP_GET_VARS["nomcateg"];
|
|
$action=$HTTP_GET_VARS["action"];
|
|
$nomfamille=$HTTP_GET_VARS["nomfamille"];
|
|
$descriptionfamille=$HTTP_GET_VARS["descriptionfamille"];
|
|
$idcategorie=$HTTP_POST_VARS["idcategorie"];
|
|
$idprod=$HTTP_GET_VARS["idprod"];
|
|
?>
|
|
<html>
|
|
<head>
|
|
<title>Partie Administrateur</title>
|
|
</head>
|
|
<body>
|
|
<?php
|
|
if (isset($_SESSION['idadm']))
|
|
{
|
|
?>
|
|
<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
|
|
require("../connexion.php");
|
|
$conn = mysql_connect($host, $user, $password);
|
|
mysql_select_db($bdd) or die("Impossible d'ouvrir la base de donnee $bdd");
|
|
|
|
$requete1 = "select idfamille,nomfamille,descriptionfamille,codefamille from famille where idfamille='$idfamille'";
|
|
$result1=mysql_query($requete1) or die ("Erreur SQL :$requete<br>".mysql_error()."...");
|
|
|
|
$requete2 = "select idprod,denomination,description from produit where idfamille='$idfamille'";
|
|
$result2=mysql_query($requete2) or die ("Erreur SQL :$requete<br>".mysql_error()."...");
|
|
|
|
$requete4 = "select idcateg,nomcateg from categorie";
|
|
$result4=mysql_query($requete4) or die ("Erreur SQL :$requete<br>".mysql_error()."...");
|
|
|
|
?>
|
|
<table>
|
|
<tr>
|
|
<td align="center">
|
|
<br><br> <b>Famille</b><br> 
|
|
</td>
|
|
</tr>
|
|
<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($result1))
|
|
{
|
|
$idfamille=$ligne[0];
|
|
$nomfamille=$ligne[1];
|
|
$descriptionfamille=$ligne[2];
|
|
$reffamille=$ligne[3];
|
|
?>
|
|
<tr>
|
|
<form name="f1" action="modiffam.php" method="POST">
|
|
<table>
|
|
<tr align='center'>
|
|
<td colspan=>
|
|
<input type="text" name="nomfamille" value="<?php print $nomfamille?>"/>
|
|
</td>
|
|
<td>
|
|
<select name="idcategorie">
|
|
<?php
|
|
while ($ligne=mysql_fetch_row($result4))
|
|
{
|
|
$idcategorie=$ligne[0];
|
|
$nomcategorie=$ligne[1];
|
|
|
|
if ($idcateg==$idcategorie)
|
|
{
|
|
?>
|
|
<option value="<?php print $idcategorie?>" selected="selected"><?php print $nomcategorie?></option>
|
|
<?php
|
|
}
|
|
else
|
|
{
|
|
?>
|
|
<option value="<?php print $idcategorie?>"><?php print $nomcategorie?></option>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2>
|
|
<textarea name="descriptionfamille" cols="50" rows="10"><?php print $descriptionfamille?></textarea>
|
|
<input type="hidden" name="<?php print session_name()?>" value="<?php print session_id()?>"/>
|
|
<input type="hidden" name="idfamille" value="<?php print $idfamille?>"/>
|
|
<input type="hidden" name="action" value="modif"/>
|
|
<input type="hidden" name="loguer" value="oui"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2 align=center>
|
|
Ref : <input type="text" name="reffamille" value="<?php print $reffamille?>"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2 align=center>
|
|
<input type="submit" value="Modifier"/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<a href="ajoutprod.php?idcateg=<?php print $idcateg?>&idfamille=<?php print $idfamille?>">Ajouter un produit</a>
|
|
<table border=1>
|
|
<tr>
|
|
<td colspan=4 align="center">
|
|
<b>Liste des produits associes</b><br> 
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
|
|
while ($ligne=mysql_fetch_row($result2))
|
|
{
|
|
$idprod=$ligne[0];
|
|
$denomination=$ligne[1];
|
|
$description=$ligne[2];
|
|
?>
|
|
<tr align='center'>
|
|
<form name="supprod" action="supprod.php" method="POST">
|
|
<td>
|
|
<?php print $idprod?>
|
|
</td>
|
|
<td>
|
|
<a href="detprod.php?loguer=oui&idfamille=<?php print $idfamille ?>&idcateg=<?php print $idcateg?>&idprod=<?php print $idprod?>"><?php print $denomination?></a>
|
|
</td>
|
|
<td>
|
|
<?php print $description?>
|
|
<input type="hidden" name="idcateg" value="<?php print $idcateg?>"/>
|
|
<input type="hidden" name="idfamille" value="<?php print $idfamille?>"/>
|
|
<input type="hidden" name="idprod" value="<?php print $idprod?>"/>
|
|
</td>
|
|
<td>
|
|
<input type="submit" value="Supprimer"/>
|
|
</td>
|
|
</form>
|
|
<td>
|
|
<a href="dupfam.php?idcateg=<?php print $idcateg ?>&idfamille=<?php print $idfamille?>&idprod=<?php print $idprod?>">Dupliquer</a>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br><a href="modifcateg.php?loguer=oui&idcateg=<?php print $idcateg ?>&<?php print session_name();?>=<?php print session_id();?>">Retour</a>
|
|
</div>
|
|
<?php
|
|
}
|
|
else
|
|
{
|
|
print "Erreur de connection";
|
|
}
|
|
?>
|
|
</body>
|
|
</html>
|