Bonjour,

Je souhaite effacer tous les boutons radios par appui sur un
bouton "effacer". Comment faut-il s'y prendre ?

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
 
 
<body> 
<h1>Logique combinatoire  .21.</h1>
<h2>Opérateurs logiques</h2><br>
 
<form action="<?php echo $_SERVER['PHP_SELF'] ; ?>" method="post">
    (1) Quel est l'opérateur logique représenté en (a)<br>
    <input type="radio" name="oper_a" value="NAND"<?php if(isset($_POST["oper_a"]) && $_POST["oper_a"]=="NAND") {
    echo " checked=\"checked\"";}?>>NAND<br>
 
    <input type="radio" name="oper_a" value="OR"<?php if(isset($_POST["oper_a"]) && $_POST["oper_a"]=="OR") {
    echo " checked=\"checked\"";}?>>OR<br>
 
    <input type="radio" name="oper_a" value="XOR"<?php if(isset($_POST["oper_a"]) && $_POST["oper_a"]=="XOR") {
    echo " checked=\"checked\"";}?>>XOR<br>
 
 
    <br>   
 
    <input type="submit" name="envoyer" value="Envoyer les données"><br><br>   
    <input type="submit" name="effacer" value="Effacer les données">
 
</form>
 
 
 
<p>
<?php
 
 
if (isset($_POST["oper_a"]) ) 
{
    switch($_POST["oper_a"]) {
        case "NAND": echo "Saisie Nand"; break;
        case "OR":   echo "Saisie OR";   break;
        case "XOR":  echo "Saisie XOR";  break;
    default: echo "";}
}
else 
{ 
    if (isset($envoyer)) 
    {
        echo "saisie incorrecte"; 
    }
}
 
if (isset($effacer)) { $_POST["oper_a"]=""; }
 
 
 
?>
</p>
 
</body>
</html>
Merci du coup de main

P.