Well, here's a example that you may want to take for references.
// HTML FORM
<form name="form" action="check.php" method="post">
<input type="password" name="pass">
<input type="password" name="pass1">
<input type="submit" name="submit">
</form>
Basically the above form just have 2 field which allows you to put enter password and re-enter password. And when the form is submitted, it pass the values to check.php.
// Check.php
// Check that the form is being submitted
if (isset($_POST['submit'])) {
// submit button is pressed, then we shall check for whether both the password entered is the same
if ($_POST['pass'] == $_POST['pass1']) {
echo "Password matched";
} else {
echo "Password does not match";
}
}
This is a very simple example and does not check thorough enough.