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.
Modifié par fredericmarcel (27 Nov 2015 - 11:11)
<?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>
Modifié par fredericmarcel (27 Nov 2015 - 11:11)