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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php //if(isset($_POST['valider']))
// {header("Location: stock_magasin_eq.php");}?>
<?php session_start(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="mainco.css" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="style.css" />
<title>Saisie Entrée</title>
</head>
<body style="background-color:#DDDDDD">
<?php
//connexion table stock_magasin_eq
if ($id = @mysql_connect ("localhost","root","pacman"))
{
if (@mysql_select_db ("logistique",$id))
{
$clt = $_SESSION['nom'];
// Début du Script
?>
<!-- Formulaire de saisie de l'enregistrement à insérer dans la table -->
<h2>Entrez les données demandées :</h2>
<form name="inscription" method="post" action="form_saisie_entree.php">
<select name="produit" Size=1 onchane="submit()" id="menuproduit">
<OPTION Value=0>Choisir un produit</OPTION>
<?php
// Sélectionne les produits à afficher dans le menu déroulant
$produit = mysql_query ("SELECT `stock_magasin_eq`.`produit` FROM stock_magasin_eq ORDER BY `stock_magasin_eq`.`produit` ASC");
$produit1 = null;
if ($produit)
{
while ($data=mysql_fetch_array($produit)) // sélectionne les enregistrements
{
if ($produit1 <> $data["produit"])
{
?>
<option><?php echo ''.$data['produit'].'';?> </option>
<?php
}
$produit1 = $data["produit"];
}
}
?>
</select><br/>
Numéro de Série : <input type="text" name="numserie"/><br/>
Numéro Qualiparc : <input type="text" name="qualiparc"/><br/>
Observation : <input type="text" name="obs"/><br/>
Quantité : <input type="text" name="qte"/><br/>
<input type="submit" name="ok" value="OK" />
<input type="reset" name="reset" value="Annuler" />
</form>
<?php
$prod=$_POST['produit'];
$numserie=$_POST['numserie'];
$qualiparc=$_POST['qualiparc'];
$obs=$_POST['obs'];
$qte=$_POST['qte'];
if(isset($_POST['ok']))
{
//On construit la date d'aujourd'hui qui servira plus tard
//strictement comme sql la construit
$today = date("y-m-d");
?>
<!-- Affiche l'enregistrement à insérer dans la table -->
<table border="1">
<tr>
<th><span class="Style4"><?php echo "Client"." "." ";?></span></th>
<th><span class="Style4"><?php echo "Catégorie"." "." ";?></span></th>
<th><span class="Style4"><?php echo "Type de Produit"." "." ";?></span></th>
<th><span class="Style4"><?php echo "Produit"." "." ";?></span></th>
<th><span class="Style4"><?php echo "N° de Série"." "." ";?></span></th>
<th><span class="Style4"><?php echo "N° Qualiparc"." "." ";?></span></th>
<th><span class="Style4"><?php echo "Observation"." "." ";?></span></th>
<th><span class="Style4"><?php echo "Quantité"." "." ";?></span></th>
</tr>
<?php
// selectionne la categorie et le type de produit correspondant au produit
$res = mysql_query ( "SELECT categorie,type_produit FROM `stock_magasin_eq` WHERE produit = '$prod' LIMIT 1");
if ($res)
{
while ($data=mysql_fetch_assoc($res))
{
?>
<tr>
<td><span class="Style5"><?php echo $clt." "." "." ";?></span></td>
<td><span class="Style5"><?php $cat = $data["categorie"];
echo $cat." "." "." ";?></span></td>
<td><span class="Style5"><?php $typ_prod = $data["type_produit"];
echo $typ_prod." "." "." ";?></span></td>
<td><span class="Style5"><?php echo $prod." "." "." ";?></span></td>
<td><span class="Style5"><?php echo $numserie." "." "." ";?></span></td>
<td><span class="Style5"><?php echo $qualiparc." "." "." ";?></span></td>
<td><span class="Style5"><?php echo $obs." "." "." ";?></span></td>
<td><span class="Style5"><?php echo $qte." "." "." ";?></span></td>
</tr>
<?php
}
}
?>
</table>
<!-- Formulaire pour confirmer l'enregistrement à insérer dans la table -->
<form action="form_saisie_entree.php" name="confirmation" method="post" >
Voulez-vous entrer cette donnée dans le stock :
<input type="submit" name="ok" value="Valider" /></td>
</form>
<?php
}
if(isset($_POST['ok']))
{
//On prépare la commande sql d'insertion
$sql = 'INSERT INTO stock_magasin_eq VALUES("","'.$clt.'","'.$cat.'","'.$typ_prod.'","'.$prod.'","'.$qte.'","'.$numserie.'","'.$qualiparc.'","'.$obs.'")';
/*on lance la commande (mysql_query) et au cas où,
on rédige un petit message d'erreur si la requête ne passe pas (or die)
(Message qui intègrera les causes d'erreur sql)*/
mysql_query ($sql) or die ('Erreur SQL !'.$sql.'<br />'.mysql_error());
header("Location: stock_magasin_eq.php");
}
// Fin du Script
}else
{
die ("La base n'a pas été trouvée");
}
@mysql_free_result($res);
@mysql_close($id);
}
else
{
die ("La connexion au Serveur à échouée");
}
?>
</body>
</html> |
Partager