0

i have problem with my code, it didn't say any error but it wont receive a data from the textfield.. is there something wrong with my code?

here is the code..

<?php 

include('config.php');

$email=$_REQUEST['email'];

$sql ="SELECT * from employee where emp_work_email = '$email'";
$hasil=mysql_query($sql) or die("E-mail is invalid".mysql_error());
$data=mysql_fetch_array($hasil);


$sql1 ="select emp_password from employee where emp_work_email = '$email' ";
$hasil1= mysql_query($sql1) or die("Password is not match".mysql_error());
$data1=mysql_fetch_array($hasil1);

if($data == $email)
{
    $to=$email;

    $subject="This is your password";

    $header="<no-reply@lms.com>";

    $message="Your password is";
    $message.= data1;

    $sentmail = mail($to,$subject,$message,$header);
}
else
{
    echo" not found email in your database";
}
if($sentmail){
    echo"Your password already sent to your email";
}
else{
    echo" cannot send to the email";
}

?>

when i run it, it show that not found email in your database..

can someone help me please? :(

5
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by jayan.bee
0

what is the URL before you start this script?
where are you requesting the $email from?

if you var_dump($email); is there a valid output?

0

$email requested from the user input, there is a textfield that allow user to enter the email, and after click submit, the script should be matching the user input email address with the one in database, if its matched, then it will send the email, if not match, it means its not in database,,

0

You are comparing $data with $email. Just print the $data array to show what it has .

var_dump($data);

So you should be using :

if($data['email'] = $email){ //depends on your coloumn 
    //your code here
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.