Here is the code
<?php
if(isset($_POST['uuser'])){
$gemail = mysql_result("SELECT `email` FROM `user` WHERE `username` LIKE '" . ($_POST['uuser']) . "';");
$to ="$gemail"; // this is user's Email address
$from = "admin@mysite.com"; // this is the sender's Email address
$first_name = $_POST['uuser'];
$last_name = $_POST['uuser'];
$subject = "Form submission";
$message = $first_name . " " . $last_name . " wrote the following:" . "
" . $_POST['message'];
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
}
?>
The problem is with $gemail its not getting email from database.