Récupérer une valeur provenant d'un script
Bonjour,
Je souhaite savoir comment puis-je récupérer la valeur de ma sélection en paramètre [qui s'affiche dans la balise "P"], l'idée étant de passer cette valeur dans une autre requête, malgré mes recherche je cale
Le code:
Code:
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
| <p id="info" name="info"></p>
<table class="tableF" id="tableau">
<thead>
<tr>
<th width=20%>Fournisseur</th>
<th width=10%>N° de commande</th>
<th width=15%>Date de création</th>
<th width=15%>Date de livraison</th>
<th width=80%>Commentaires</th>
<th width=100%>Code article</th>
<th width=100%>Désignation</th>
<th width=100%>Quantité</th>
<th width=17%>......</th>
</tr>
</thead>
<tbody>
<!-- CONSTRUCTION TABLEAU DES CMD -->
<?php
require('../simag/inc/connect.ini.php');
$query = $bdd->prepare('SELECT CMD_LIBELLE,CMD_NUM,CMD_CREATE,CMD_DELIVERY,CMD_COMMENTS,LIG_ART_CODE,LIG_ART_LIBELLE,SUM(LIG_ART_QTY) FROM CMD,CMD_LIGNE WHERE CMD_NUM=LIG_NUM_CMD GROUP BY LIG_ART_CODE ORDER BY CMD_CREATE');
$query->execute();
while ($data = $query->fetch()) {
?>
<tr onclick="fctClick(this)">
<td><?php echo $data['CMD_LIBELLE']; ?></td>
<td><?php echo $data['CMD_NUM']; ?></td>
<td><?php echo $data['CMD_CREATE']; ?></td>
<td><?php echo $data['CMD_DELIVERY']; ?></td>
<td><?php echo $data['CMD_COMMENTS']; ?></td>
<td><?php echo $data['LIG_ART_CODE']; ?></td>
<td><?php echo $data['LIG_ART_LIBELLE']; ?></td>
<td><?php echo $data['SUM(LIG_ART_QTY)']; ?></td>
<td><button class="btnR" onClick="bascule('boite');">+</button></td>
</tr>
<?php
}
?>
</tbody>
</table>
</body>
<script>
tableau.onclick = e => {
if (!e.target.matches('td')) return
let eTD = e.target,
eTR = eTD.parentNode;
info.textContent = ` ${eTD.textContent}`
}
</script> |
Par avance merci pour vos idées
PROBLEME EN COMPLEMENT DU PREMIER
Bonsoir,
Après la résolution de mon premier soucis, j'en ai un second.
Je n'arrive pas à passer en paramètre dans ma seconde requête l'input "codeart" dans lequel j'affiche mon code article
Code:
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
| <body>
<table class="tableF" id="tableau">
<thead>
<tr>
<th width=10%>Code article</th>
<th width=10%>Désignation</th>
<th width=10%>Quantité</th>
<th width=10%>N° commande</th>
<th width=10%>Date création</th>
<th width=10%>Date livraison</th>
<th width=60%>Commentaires</th>
<th width=100%>Libellé</th>
<th width=17%>......</th>
</tr>
</thead>
<tbody>
<!-- CONSTRUCTION TABLEAU DES CMD -->
<?php
require('../simag/inc/connect.ini.php');
$query = $bdd->prepare('SELECT CMD_LIBELLE,CMD_NUM,CMD_CREATE,CMD_DELIVERY,CMD_COMMENTS,LIG_ART_CODE,LIG_ART_LIBELLE,SUM(LIG_ART_QTY) FROM CMD,CMD_LIGNE WHERE CMD_NUM=LIG_NUM_CMD GROUP BY LIG_ART_CODE ORDER BY CMD_CREATE');
$query->execute();
while ($data = $query->fetch()) {
?>
<tr onclick="fctClick(this)">
<td><?php echo $data['LIG_ART_CODE']; ?></td>
<td><?php echo $data['LIG_ART_LIBELLE']; ?></td>
<td><?php echo $data['SUM(LIG_ART_QTY)']; ?></td>
<td><?php echo $data['CMD_NUM']; ?></td>
<td><?php echo $data['CMD_CREATE']; ?></td>
<td><?php echo $data['CMD_DELIVERY']; ?></td>
<td><?php echo $data['CMD_COMMENTS']; ?></td>
<td><?php echo $data['CMD_LIBELLE']; ?></td>
<td><button class="btnR" onClick="bascule('boite');">+</button></td>
</tr>
<?php
}
?>
</tbody>
</table>
<script>
tableau.onclick = e => {
if (!e.target.matches('td')) return
let eTD = e.target,
eTR = eTD.parentNode;
var myvalue = info.textContent = ` ${eTD.textContent}`;
document.getElementById('codeart').setAttribute('value', myvalue);
}
</script>
<p style="display:none" id="info" name="info"></p>
<input type="text" id="codeart" name="codeart" value="">
<form method="POST" action="" class="forma">
<div name="boite" id="boite" style="visibility: hidden">
<table class="tableF" id="ligneCmd">
<thead>
<tr>
<th width=20%>N° de commande</th>
<th width=10%>Code article</th>
<th width=15%>Désignation</th>
<th width=15%>Coloris</th>
<th width=80%>UVC</th>
<th width=100%>Taille</th>
<th width=100%>Quantité</th>
<th width=17%>......</th>
</tr>
</thead>
<tbody>
<!-- CONSTRUCTION TABLEAU DES CMD -->
<?php
require('../simag/inc/connect.ini.php');
$query1 = $bdd->prepare('SELECT LIG_NUM_CMD,LIG_ART_CODE,LIG_ART_LIBELLE,LIG_ART_COLOR,LIG_UVC,LIG_ART_TAILLE,LIG_ART_QTY FROM CMD_LIGNE WHERE LIG_ART_CODE="' . $_POST['codeart'] . '" ORDER BY LIG_ART_COLOR');
$query1->execute();
var_dump($query1);
while ($data = $query1->fetch()) {
?>
<tr onclick="fctClick(this)">
<td><?php echo $data['LIG_NUM_CMD']; ?></td>
<td><?php echo $data['LIG_ART_CODE']; ?></td>
<td><?php echo $data['LIG_ART_LIBELLE']; ?></td>
<td><?php echo $data['LIG_ART_COLOR']; ?></td>
<td><?php echo $data['LIG_UVC']; ?></td>
<td><?php echo $data['LIG_ART_TAILLE']; ?></td>
<td><?php echo $data['LIG_ART_QTY']; ?></td>
<td><button class="btnR" name="envoi" onClick="bascule('boite');">+</button></td>
</tr>
<?php
}
?>
<input type="text" name="artcode" id="codeart" value="<?php echo $_POST['codeart']; ?>">
</tbody>
<?php
if (isset($_POST['envoi'])) {
echo $_POST['codeart'];
}
?>
</body> |
Je crois avoir tout essayé, mais nul doute que je commets une erreur mais je cale....
Par avance merci pour vos idées