Bonjour,
comment écrire un code php pour que le form s’exécute si on rempli toutes le input?
ça fait deux jours que j’essaye sans résultat
voici la page:
http://cadtuts.eu/page7.php

page7.php

Code html : 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
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="style1.css">
</head>
<body>
<div class="wrapper">
    <div class="header">
        <h1>COUDE A ELEMENTS (Miter Elbow)</h1>
    </div>
    <div class="clearfix">
        <div class="column menu">
            <form action="afficher.php" method="post">
                <label for="fname">Diamètre:</label>
                <input type="text" id="diametre" name="diametre"  placeholder="diametre"  >
 
 
                <label for="fname">Nombre d'éléments:</label>
                <input type="text" id="element" name="element" placeholder="element" >
 
 
                <label for="fname">Angle:</label>
                <input type="text" id="angle" name="angle" placeholder="angle" >
 
 
                <label for="fname">Rayon:</label>
                <input type="text" id="rayon" name="rayon" placeholder="rayon" >
 
 
                <label for="fname">Division:</label>
                <input type="text" id="division" name="division" placeholder="division" >
 
                <input type="hidden" name="action" value="submit">
                <input type = "submit" value = "Calculer">
 
            </form>
        </div>
 
        <div class="column content">
 
            <img src="coude.png" alt="piquage" >
 
            <script type="text/javascript" src="https://www.freevisitorcounters.com/en/home/counter/542968/t/5"></script>
            <br>
 
            <a href="http://www.cadtuts.eu" target="_blank">cadtuts.eu</a>
        </div>
    </div>
 
</div><!--wrapper-->
</body>
</html>

afficher.php

Code html : 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
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
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="style1.css">
</head>
<body>
<div class="wrapper">
    <div class="header">
        <h1>COUDE A ELEMENTS</h1>
    </div>
    <div class="clearfix">
        <div class="column menu">
            <?php
            if ($_SERVER[‘REQUEST_METHOD’] === ‘POST’){
                    if (empty($_POST['diametre'])) {
                        echo "Entrez le diametre";
                    } else {
                        $diametre = $_POST['diametre'];
                    }
 
                    if (empty($_POST['element'])) {
                        echo "Entrez le element";
                    } else {
                        $element = $_POST['element'];
                    }
 
                    if (empty($_POST['angle'])) {
                        echo "Entrez le angle";
                    } else {
                        $angle = $_POST['angle'];
                    }
 
                    if (empty($_POST['rayon'])) {
                        echo "Entrez le rayon";
                    } else {
                        $rayon = $_POST['rayon'];
                    }
 
                    if (empty($_POST['division'])) {
                        echo "Entrez le division";
                    } else {
                        $division = $_POST['division'];
                    }
            }
 
            $RayonTuyau = $diametre / 2;
            echo "Diamètre: " . $diametre . "<br />";
            echo "Elements: " . $element . "<br />";
            echo "Angle [ß = δ] : " . $angle . "<br />";
            echo "Rayon: " . $rayon . "<br />";
 
            $AngleCentreElement = $angle/$element;
            echo "ε : " . $AngleCentreElement . "<br />"; // angle EPSILON
            $AngleTheta = $AngleCentreElement / 2 ;
            echo "Θ :  " . $AngleTheta . "<br />";  // angle THETA
 
            $bc = tan(deg2rad($AngleTheta))*$rayon ;
            $be = $bc * 2;
            $jk = (tan(deg2rad($AngleTheta)) * ($rayon - ($diametre/2)) * 2);
 
            if ($jk > 50){
                $im = (tan(deg2rad($AngleTheta)) * ($rayon + ($diametre/2)) * 2);
                $l = $RayonTuyau * tan(deg2rad($AngleTheta));
 
                echo "BC = " . number_format($bc,1) . "<br />";
                echo "BE = " . number_format($be,1) . "<br />";
                echo "JK = " . number_format($jk,1) . "<br />";
                echo "IM = " . number_format($im,1) . "<br />";
                echo "L3 = " . number_format($l,1) . "<br />" . "<br />";
 
                echo "Development: (L1, L2, L3...)" . "<br />" . "<br />";
                for ($i=0; $i<=360; $i=$i+360/$division) {
                    $aa = cos(deg2rad($i)) * $RayonTuyau;
                    $xx = $RayonTuyau - $aa;
                    $resultat  = tan(deg2rad($AngleTheta)) * $xx;
                    echo   number_format($resultat,1) . "<br />";
                }
 
            }else{
 
                echo "J-K doit etre plus grand que 50mm.". "<br />";
                echo "J-K = " . number_format($jk,1) . "mm" . "<br />";
            }
 
            ?>
        </div>
        <div class="column content">
            <img src="coude.png" alt="piquage" >
            <script type="text/javascript" src="https://www.freevisitorcounters.com/en/home/counter/542968/t/5"></script>
            <br>
            <a href="http://www.cadtuts.eu" target="_blank">cadtuts.eu</a>
        </div>
    </div>
</div><!--wrapper-->
</body>
</html>

merci d'avance ;-)