To begin with, how did you execute the script? If you tried executing the script directly by pointing your browser to something like http://localhost:8080/login.php where localhost:8080 is assumed to be your server amd login.php is assumed to be your login script, then you have made few mistakes.
To begin with, direct executions like the one mentioned above takes place as GET request. Whenever the client (browser) requests the server for a resource, it always issues a GET request. In that case, you can try something like http://localhost:8080/login.php?username=root&password=root
Then, in your script, as you are using GET, use $_GET global array. Something like
<?php
var_dump($_GET['username']);
var_dump($_GET['password']);
?>
Should show root as username and password.
As you can see, this is a very insecure idea. Your username and password is available in the wild. To reduce this, enter POST.
POST has more capacity (it can transfer more data) than GET. Also, the data transfered by POST is hidden (not available as query strings) as in the case of GET.
Before going further, create a simple login form like
<form method="POST">
<input type="text" name="username">
<input type="password" name="password">
</form>
and save it as login.php Now, you might have noticed that I have not mentioned the action attribute. This is because by default action attribute refers to the same page - which is exactly what we want.
Now, add the following to login.php
<?php
var_dump($_POST['username']);
var_dump($_POST['password']);
?>
You might have noticed that the name attribute used for input elements in the form matches exactly with the keys used to access the $_POST global array. This is no coincidence. This is because the values send via POST request to the server is allocated in the $_POST global array based on the name to it using the name attribute.
Also, the method attribute of form element had to specified to POST because, as already mentioned, the browser uses GET to send requests to the server by default.