If you are posting the data on the same page you could do the following:
<?php
    if(isset($_REQUEST["submit"])){
        // mySQL code here
        // return either success or failed
        $confirmation="success";
    }
?>
<html>
<head>
    <title>Feedback</title>
</head>
<body>
    <div>
        <?php 
            if(isset($confirmation)){
             echo $confirmation;
            } 
        ?>
    </div>
    <form method="post" action="">
        <input type="text" name="username">
        <input type="password" name="password">
        <input type="submit" name="submit" Value="Submit">
    </form>
</body>
</html>
If you are sending the data to a separate page:
On the receiving page:
<?php
        // mySQL code here
        // return either success or failed
        //redirect to index.php with confirmation as true or false
        header('location:index.php?confirmation=success');
?>
and on the page that you Sent the data from:
<html>
<head>
    <title>Feedback</title>
</head>
<body>
    <div>
        <?php 
            //at index page where you want to display message
            if(isset($_GET['confirmation']) && !empty($_GET['confirmation'])){
                echo $_GET['confirmation'];
            }
        ?>
    </div>
    <form method="post" action="uploaddata.php">
        <input type="text" name="username">
        <input type="password" name="password">
        <input type="submit" name="submit" Value="Submit">
    </form>
</body>
</html>
You can then use CSS3 animations to fade the message in and out for a better user experience :-)