I try to get data from form using $_POST
but it always return error
PHP Notice: Undefined index:
I tried everything to make it work but it is not working ??? This is my PHP Code
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST["username"])){
$username = $_POST['username'];
echo $username;
}
if (isset($_POST["username"])){
$password = $_POST['password'];}}
And this is the Form
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
<input type="text" placeholder="Username" name="username" id="username" required="required"/>
<input type="password" name="password" placeholder="Password" id="password" required="required"/>
<button type="submit" class="btn btn-primary btn-block btn-large" name="submit">Let me
in.
</button>
</form>
I used if condition to solve Undefined index problem but I still can not get my data from my Form
I using phpstorm and Ampps apache am sure from my code but I don't determine where is my problem with PHP config
I made some changes in php.ini to install XDabug but I don't remember things that I changed