Bonjour all,
Je suis nouveau sur le forum donc je vais essayer d'être le plus clair possible.
Voila, je suis sur un projet à faire et j'ai presque fini me reste juste à calculer le prix total de ma commande.
pour cela j'ai une table "objet" avec les colonne identifiant,prix,nom,stock.
Voici mon code :
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<form id="monForm" action="commande.php"  method="post">
	<fieldset>
		<table>
						<caption>commande</caption>
						<colgroup>
						<col span="1" id="navcol"/>
						<col span="1" id="numcol"/>
						</colgroup>
						<tr><th>Identifiant</th><th>Nom</th><th>Prix</th><th>Stock</th><th>Etat</th></tr>
<?php
	if(isset($_POST['val'])){
		$idconnect=mysqli_connect('localhost','root',NULL,'bd');				
		foreach($_POST as $key => $val) {
			if($key!='conf') {
				$query="select *from article where identifiant='$key' ";
				$result=mysqli_query($idconnect,$query);
					while($row=mysqli_fetch_row($result)) {
						$identifiant=$row[0];
						$nom=$row[1];
						$prix=$row[2];
						$stock=$row[3];
						$radio='<input type="radio" checked="checked" name="'.$identifiant.'"/>';
						echo '<tr><td>'.$identifiant.'</td><td>'.$nom.'</td><td>'.$prix.'</td><td>'.$stock.'</td><td>'.$radio.'</td></tr>';
//ici je veux ajouter une ligne avec le montant total des article avec un bouton radio.					
					}
			}
		}
		mysqli_close($idconnect);
	}
 
?>
</table>
		<p>
		<label class="nostyle">&nbsp;</label>
		<input type="submit" value="Confirmer" name="conf"/></p>
		<p>
		<label class="nostyle">&nbsp;</label>
		<input type="submit" value="Annuler" name="res"/></p>
 
</fieldset>
</form>
Je voudrais calculer le montant total de mes article avec un bouton radio checké .
Mais je ne sais pas comment faire , donc SVP help me