Actually, I have plenty of Websites where the passwords are stored plain text and unencrypted simply because there's no secure information to be had by having the password anyway. In that case, you're fine to store passwords unencrypted (there are methods of decoding an encrypted MySQL password however, I wouldn't go that route to protect FBI documents though ;-) ...
However, since it's a registration number...
Yeah, it's actually fairly simple.
Plug your $_POST var into a simply SQL query:
[Form Handler (getreg.php)]
<?
$db = mysql_connect($dbserver,$username,$password) or die ("Could not connect...");
$select_db = mysql_selectdb($database) or die ("Could not connect...");
$query = "SELECT reg_number FROM reg_numbers WHERE email = ' ".trim($_POST["email"]);
$result = mysql_query($sql) or die("Invalid query");
$row = mysql_fetch_row ($result);
if ($row){
$to = trim($_POST["email"]);
$subject = "whatever..";
$message = $row[0];
$mailed = mail ( $to, $subject, $message );
if($mailed){
print "You registration number has been sent.";
}
}
//...clean up, etc.
//use elses for alternate cases of course ;-)