| 12
 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
 
 | <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
</head>
<body>
<div id="remarque"></div>
    <form id="form">
      <table>
      <tr>
        <td>Votre Adresse mail :</td>
        <td colspan="9"><input type="text" id="email" name="email" size="50"></td>
      </tr>
      <tr>
        <td>Vos coordonnées postales :</td>
        <td colspan="9"><input type="text" id="poste" name="poste" value="Exemple 75000 PARIS" size="100"></td>
      </tr>
      <tr>
        <td colspan="10"> </td>
      </tr>
      <tr>
        <td>Carte A : l'empereur Palpatine</td>
        <td colspan="9"><input type="number" id="quantityA" name="quantityA" min="0" max="50" value="0" style="width: 4em;"></td>
      </tr>
      <tr>
        <td>Carte B : Yoda</td>
        <td colspan="9"><input type="number" id="quantityB" name="quantityB" min="0" max="50" value="0" style="width: 4em;"></td>
      </tr>
      <tr>
        <td>Carte C : R2-D2</td>
        <td colspan="9"><input type="number" id="quantityC" name="quantityC" min="0" max="50" value="0" style="width: 4em;"></td>
      </tr>
      <tr>
        <td>Carte D : Chewbacca</td>
        <td colspan="9"><input type="number" id="quantityD" name="quantityD" min="0" max="50" value="0" style="width: 4em;"></td>
      </tr>
      <tr>
        <td>Carte E : Kylo Ren</td>
        <td colspan="9"><input type="number" id="quantityE" name="quantityE" min="0" max="50" value="0" style="width: 4em;"></td>
      </tr>
      <tr>
        <td>Carte F : BB-8</td>
        <td colspan="9"><input type="number" id="quantityF" name="quantityF" min="0" max="50" value="0" style="width: 4em;"></td>
      </tr>
      <tr>
        <td>Carte G : Jabba le Hutt</td>
        <td colspan="9"><input type="number" id="quantityG" name="quantityG" min="0" max="50" value="0" style="width: 4em;"></td>
      </tr>
      <tr>
        <td>Carte H : Jawa</td>
        <td colspan="9"><input type="number" id="quantityH" name="quantityH" min="0" max="50" value="0" style="width: 4em;"></td>
      </tr>
     </table>
      <br><br><input type="submit" id="poster" value="Proposer mon Album !" class="button" />
    </form>
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
        $("#poster").on("click", function(e){
                        e.preventDefault();
 
                        $.post( 
                                "verification.php", // Un script PHP
                                {
                                        email : $("#email").val(),
                                        poste : $("#poste").val(),
                                        quantityA : $("#quantityA").val(),
                                        quantityB : $("#quantityB").val(),
                                },
                                function(data){
                                        var email = $("#email").val();
                                        var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
                                        if (reg.test(email))
                                                {
                                                        if (data.indexOf("Success")>=0) {
                                                                $("#remarque").html("<div class='zone_ok'>Merci pour ta participation, tu vas recevoir un mail très rapidement.<br>"+data+"</div>");
                                                                $("#form").remove();
                                                        }
                                                        else{
                                                                $("#remarque").html("<div class='zone_erreur'>Erreur ! les champs ne sont pas bien remplis !</div>");
                                                        }
                                                }
                                                else
                                                {
                                                alert("Veuillez renseigner un bon mail !");
                                                }
                                }
                        );
                });
    </script>           
</body>
</html> | 
Partager