Hi I am trying to make a script forgot password so when user enter email in it it will verify that if entered email matches the database email if yes then sends confirmation email to his email address. It was working fine untill I was using mysql but after converting it to mysqli it not working. When user enter email in it it does't send email or even it doesn't echo that email sent or no errors.
Here is my Forgot.php script (UPDATED SCRIPT AGAIN)
<?php
error_reporting(0);
if($_POST['submit']=='Send') {
//keep it inside
$email=$_POST['email'];
$con=mysqli_connect("lovehost","root","123","user");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = mysqli_query($con,"select * from login where user_email='$email'") or die(mysqli_error($con));
$numrows = $query->num_rows();
if ($numrows == 1) {
$code=rand(100,999);
$message='You activation link is: http://bing.fun2pk.com/forgot.php?email=$email&code=$code';
mail($email, "Subject Goes Here", $message);
echo 'Email sent';
} else {
echo 'No user exist with this email id';
}
}
?>
<form action="forgot.php" method="post">
Enter you email ID: <input type="text" name="email">
<input type="submit" name="submit" value="Send">
</form>