I made a basic HTML form working with post (it's a login form). The form itself works great, but when I try to work with the information contained in $_POST it goes wrong.
<?php
// case : nothing submitted
if (!isset($_POST['submit'])) {
?>
<div class="login">
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<p>Login</p>
<input type="text" id="username" placeholder="Username" name="username" />
<input type="password" id="password" placeholder="Password" name="password" />
<button name="submit">Submit</button>
</form>
</div>
<?php
// case : input form submitted
} else {
check_credentials();
}
?>
The problem is, it works fine when I do this ( above check_credentials()
:
echo $_POST['username'];
echo $_POST['password'];
But when I do this :
echo $_POST['username'] + " " + $_POST['password'];
It echoes 0. As check_credentials()
is a function that connects to my DB, the request isn't executed. Does someone have any idea of the possible cause ?
Greetz !