par
dan420 » 07 déc. 2011, 19:14
Bonjour,
J'ai une table avec 10 lignes. chaque rangée a trois colonnes. Colonne1 est le nom du produit, colonne2 est une liste déroulante avec des valeurs de 1à 10. Colonne3 est une case à cocher.
Lorsque la case est cochée je voudrais récupérer les valeurs de la rangée entière (nom du produit, quantité)
Quelqu'un peut-il m'aider comment puis-je faire cela?
Merci pour votre aide
Code : Tout sélectionner
<?php
echo "<table id=serTable border=1 width=100%>";
echo "<tr>";
echo "<td>Nom de service</td>";
echo "<td>Quantité</td>";
echo "<td>Choix</td>";
echo "</tr>";
$servicenom = new Services();
$serviceListe = $servicenom->getAllServices();
foreach ($serviceListe as $service){
echo "<tr>";
echo "<input type=hidden name=serId value=".$service->serId.">";
echo "<td>" .$service->serTheme."</td>";
echo "<td>";
echo "<select name=qtySelectSer>";
for ($n=0; $n<11; $n++){
echo "<option value=qty>".$n."</option>";
}
echo "<select>";
echo "</td>";
echo "<td><input type=checkbox name=choixSer[] value=" . $service->serId ."> </td>";
echo "</tr>";
}
echo "</table>";
?>
</td>
Pour récupérer les valeurs
Code : Tout sélectionner
<?php
if (isset($_POST['choixSer'])) {
echo "Vous avez choisi service :";
for ($i = 0, $c = count($_POST['choixSer']); $i < $c; $i++) {
echo "<br/><b>" . $_POST['choixSer'][$i] . "</b>";
echo "<br/><b>" . $_POST['qtySelectSer'] . "</b>";
echo "<br/><b>" . $_POST['qtySelectProd'] . "</b>";
echo "<br>";
}
}
?>
J'ai toujour "0" comme quantité
Merci
Bonjour,
J'ai une table avec 10 lignes. chaque rangée a trois colonnes. Colonne1 est le nom du produit, colonne2 est une liste déroulante avec des valeurs de 1à 10. Colonne3 est une case à cocher.
Lorsque la case est cochée je voudrais récupérer les valeurs de la rangée entière (nom du produit, quantité)
Quelqu'un peut-il m'aider comment puis-je faire cela?
Merci pour votre aide
[code]
<?php
echo "<table id=serTable border=1 width=100%>";
echo "<tr>";
echo "<td>Nom de service</td>";
echo "<td>Quantité</td>";
echo "<td>Choix</td>";
echo "</tr>";
$servicenom = new Services();
$serviceListe = $servicenom->getAllServices();
foreach ($serviceListe as $service){
echo "<tr>";
echo "<input type=hidden name=serId value=".$service->serId.">";
echo "<td>" .$service->serTheme."</td>";
echo "<td>";
echo "<select name=qtySelectSer>";
for ($n=0; $n<11; $n++){
echo "<option value=qty>".$n."</option>";
}
echo "<select>";
echo "</td>";
echo "<td><input type=checkbox name=choixSer[] value=" . $service->serId ."> </td>";
echo "</tr>";
}
echo "</table>";
?>
</td>
[/code]
Pour récupérer les valeurs
[code]
<?php
if (isset($_POST['choixSer'])) {
echo "Vous avez choisi service :";
for ($i = 0, $c = count($_POST['choixSer']); $i < $c; $i++) {
echo "<br/><b>" . $_POST['choixSer'][$i] . "</b>";
echo "<br/><b>" . $_POST['qtySelectSer'] . "</b>";
echo "<br/><b>" . $_POST['qtySelectProd'] . "</b>";
echo "<br>";
}
}
?>
[/code]
J'ai toujour "0" comme quantité
Merci