Bonjours,

Comme le titre l'indique voila ou je bloque j ai créé un formulaire simple juste
pour un test.
le formulaire enregistre le montant des achats dans une base donnés jusque ici
tout beigne le problème c est que j arrive pas a réinitialisé les valeur des
Checkbox il reste coché alors ce dont j ai besoin c'est un petit script dans un
bouton qui sera a peux prêt comme ça OnClick"Reset les Checkbox a zéro" !!!
merci de me filé un coup de main je suis bloqué et voici le 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
error_reporting(0);
?>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Dolomats in the house!</title>
</head>
<body bgcolor="#000000" text="#ffffff">
<center>
<u>
</u><h1><u>Dolomats in the house!</u></h1>
<u><u>
</u></u>
<form method="post" action="index.php" id='form-commande'>
<table style="text-align: center;" border="0" width="80%">
<tbody><tr>
  <td><img src="images/boot2_s.jpg" width="92" height="114"></td>
  <td><img src="images/boot_s.jpg" width="96" height="113"></td>
  <td><img src="images/hat_s.jpg" width="99" height="80"></td>
</tr><tr>
  <td><input name="produit[]" id="produit1" type="checkbox" value="239" <?php  foreach($_POST[produit] as $produit){ if($produit == "239"){ echo('checked="checked"'); break;} }?>>239$</td>
  <td><input name="produit[]" id="produit2" type="checkbox" value="219" <?php  foreach($_POST[produit] as $produit){ if($produit == "219"){ echo('checked="checked"'); break;} }?>>219$</td>
  <td><input name="produit[]" id="produit3" type="checkbox" value="300" <?php  foreach($_POST[produit] as $produit){ if($produit == "300"){ echo('checked="checked"'); break;} }?>>300$</td>
</tr><tr>
  <td><img src="images/wool_s.jpg" width="96" height="113"></td>
  <td><img src="images/jeans_s.jpg" width="96" height="113"></td>
  <td><img src="images/samta_s.jpg" width="99" height="80"></td>
</tr><tr>
  <td><input name="produit[]" id="produit4" type="checkbox" value="89" <?php  foreach($_POST[produit] as $produit){ if($produit == "89"){ echo('checked="checked"'); break;} }?>>89$</td>
  <td><input name="produit[]" id="produit5" type="checkbox" value="45" <?php  foreach($_POST[produit] as $produit){ if($produit == "45"){ echo('checked="checked"'); break;} }?>>45$</td>
  <td><input name="produit[]" id="produit6" type="checkbox" value="25" <?php  foreach($_POST[produit] as $produit){ if($produit == "25"){ echo('checked="checked"'); break;} }?>>25$</td>  
</tr><tr><td colspan="3"><input value="Commander" type="submit" >&nbsp;<input type="reset" value="Effacer">
</td></tr></tbody></table>
</form>
 
<?php
 
$con = mysql_connect("localhost","root","");
 
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
 
mysql_select_db("dolomats", $con);
 
if(isset($_POST[produit])){
	$montant_commande = 0;
	foreach($_POST[produit] as $produit){
	$montant_commande =  $montant_commande + $produit;
	mysql_query("INSERT INTO commande (montant_produit) VALUES ($produit)");
	}
	echo ("Le montant de la commande est de : $montant_commande");
 
}
mysql_close($con);
 
?>
</center></body></html>