First, you want to send your form data to a php script, so for ex., on your form you will want
<form action="getPass.php" method="post" name="login">
then on your php script you will want to accept the username, and then query the database for that person's password, and then finally email it to them. It might look something like this:
<?php
$username = $_POST['username'];
$sql = "SELECT password, email
FROM TABLE
WHERE USERNAME = '$username'";
// connect to database and run query. This code will differ depending on what kind of database you have
$db = db_connect();
$results = runSQL($db, $sql);
$row = $results->fetchRow();
//now email the results to the user. This code assumes you have columns named 'email' and 'password' in your table.
if (mail($row['email'], "Your Password", "Your password is ".$row['password']))
echo "Email Sent Successfully";
?>