salut bon j'ai 2 table pack, commande
pack(ref_pack, lib_pack, qts_pack...)
commande(num_cde, refp_cde, qt_cde...)
bon la table pack est deja remplis des données ex
reference: R1001
Libellé : Pack decouverte
Quantité en stock : 5
bon pour le formulaire commande
j'ai chargé les données du ref_pack dans refp_cde ce que j'ai obtenu une liste deroulante(combo)
bon quand l'utilisateur saisie une quantité je dois tester cette derniere par rapport a la quantité en stock alors je me suis servis du champs masqué (hiden)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 Libellé <select name="refp_cde" > <option value="">---</option> <?php include"connexion.php"; $sql="select * from pack"; $req=mysql_query($sql) or die("Error en sql".mysql_error()); while($l=mysql_fetch_array($req)) { echo'<option value="'.$l['ref_pack'].'">'.$l['lib_pack'].'</option>'; } mysql_close(); ?> </select>
je veux que quand l'utilisateur choisi un pack automatiquement le champ masqué dois conserver la quantité en stock
et puis quand je saisie la quantité commandée il dois tester par rapport a le champ masqué
voila code pour affichage quantités en stock dans le champ masqué
affichage_qts.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <?php $ref_pack=$_POST['ref_pack']; include"connexion.php"; $sql="select qts_pack from pack, commande where pack.ref_pack = commande.refp_cde and ref_pack='$refp_cde'"; $req=mysql_query($sql) or die("error en sql". mysql_error()); $l=mysql_fetch_array($req); extract($l); echo'<form method="POST" >'; echo'<input type="hidden" name="qts_pack" value="'.$l['qts_pack'].'"/>'; mysql_close(); ?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 <;php $numc_cde=$_POST['numc_cde']; $refp_cde=$_POST['refp_cde']; $date_cde=date('y/m/d'); $qt_cde=$_POST['qt_cde']; if($qt_cde =='') { echo '<font size="4" face="Verdana, Arial, Helvetica, sans-serif"> <div align="center"><font color="#FD0000"> <p align=center> <img src="../images/cancel.png" width="18" height="24"> veuillez saisir la QT ? Svp</p>'; $etat=1; } else { include"affichage_qts_php"; if ($qt_cde>$qts_pack then echo'attention qT cde > qt en stock' }







Répondre avec citation
Partager