I input using the form then $_POST, the code look like this
<form class="form-signin" method="POST" action="">
<div class="form-label-group">
<label for="username">User Name</label>
<input type="text" name="username" class="form-control" placeholder="username" required autofocus>
</div>
<div class="form-label-group">
<label for="password">Password</label>
<input type="password" name="password" class="form-control" placeholder="Password" required>
</div>
<button class="btn btn-primary mt-3" type="submit" name="SubmitLogin">Submit</button>
</form>
it's just a simple username and password, then I check the username and password using this code
if(isset($_POST["SubmitLogin"])){
$data = $_POST['SubmitLogin'];
var_dump($data);
$username = $data['username'];
$password = $data['password'];
$result = mysqli_query($mysqli, "SELECT COUNT(*) AS Exist FROM user WHERE username = '$username' AND pwd = '$password' ");
$login = mysqli_fetch_array($result);
if($login['Exist'] == 1){
$_SESSION["Login"] = true;
header('Location:index.php');
}else{
echo '<script language="javascript">';
echo 'alert("Username/Password wrong")';
echo '</script>';
}
}
and unfortunately as written in the code I want to check what is inside $_POST["SubmitLogin"] by containing it in $data variable and it returns "" instead....what could possibly fix this?