Lorsque je clique sur le bouton "connexion", Chrome rafraichit la page et la remet au démarrage au lieu de m'afficher les variables $username et $password.
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 <?php // define variables and set to empty values $username = $password = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $username = test_input($_POST["username"]); $password = test_input($_POST["password"]); echo $username; echo $password; } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = mysqli_real_escape_string($data); $data = htmlspecialchars($data); return $data; } ?> </head> <body> <div class="container"> <div class="logo"> <div id="realizer">realizer </div> <div id="autoCoaching">auto-coaching</div> </div> <div id="connexion" align="center"> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> <div id="username"> <input id="username" type="text" placeholder="votre identifiant"» name="username" title="Username" value="<?php echo $username;?>"> </div> <div id="password" > <input id="password-field" type="password" placeholder="votre mot de passe" » name="password" title="Password" value="<?php echo $password;?>"> </div> <div id="submit" style="position:relative; top:15px;" > <input type="submit" name="submit" » value="connexion" > </div> </form> </div>







Répondre avec citation
Partager