Look at this file please:

$servername = "localhost";
$dbname = "mydbname";
$dbusername = "mydbusername";
$dbpassword = "mydbpassword";

try {
    $conn = new PDO("mysql:host=$servername;dbname=$dbname", $dbusername, $dbpassword);

    $sql = "INSERT INTO Users (Username, Password)
    VALUES ('$username', '$password')";

catch(PDOException $e)
    echo $sql . "<br>" . $e->getMessage();

$conn = null;

    <title>Register Page</title>
<form method="post">
Your Username: <input type="text" name="username"><br>
Your Password: <input type="text" name="password"><br>
<input type="submit" value="submit">

Why it can't send the username and password that gets from those two fields to the table? I checked the table, the ID was incresed everytime but the fileds of username and password were empty on the table.

I think the reason must be the action= wich is not in the <form> tag. The action sets the Destination where data should be sent to, correct? So here that the Destination is not an other php file, is db table, what can i type for action for the <form> tag?

The action is not a mandatory as if it is not set, the form will just post to same file. The problem here mostly is about the part

VALUES ('$username', '$password')";

where these 2 variables is not set to anything yet. Perhaps adding these lines before the query will help.

$username = $_POST['username'];
$password = $_POST['password'];

Yesssss! It works :)
Thank you @lps.

If the issue is solve, please do mark this article as 'solved'. Thanks