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..




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

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

if($data == $email)

    $subject="This is your password";


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

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


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

can someone help me please? :(

Recommended Answers

All 6 Replies

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?

$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,,

what is the output of var_dump($email)?

Is this information transfering?


if($data == $email)


if(in_array($email, $data))

Check it!

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


So you should be using :

if($data['email'] = $email){ //depends on your coloumn 
    //your code here
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.