I have a database which contains user emails and automatically generated usernames, and I have a form in which the user enters their email to retrieve their username, here is my code
<html>
<body>
<form method="post" action="retrievedetails.php">
<p><label for="email">Email:</label>
<input name="email" type="text"/>
</p>
<input type="submit" name="submit" value="submit"/>
</form>
<?php
session_start();
$connect=mysql_connect("localhost","dfarrelly","1234") or die("Could not connect to database");
mysql_select_db("game", $connect) or die("Couldn't find db");
if(isset($_POST['submit'])) {
$email=$_POST['email'];
$email_check=mysql_query("SELECT user_name FROM details WHERE user_email='$email'");
$name=mysql_num_rows($email_check);
$subject="Login Info";
$message="Your username is .$name";
$from="From: test@gmail.com";
mail($email, $subject, $message, $from);
echo "your username has been emailed to you";
}
?>
</body>
</html>
I am not getting any errors, I am just not receiving the email, can anyone help me with this?