send email Undefined variable:

Thread Solved

Join Date: Mar 2008
Posts: 63
Reputation: sukhy_1 is an unknown quantity at this point 
Solved Threads: 3
sukhy_1 sukhy_1 is offline Offline
Junior Poster in Training

send email Undefined variable:

 
0
  #1
Mar 27th, 2008
error message Notice: Undefined variable: sentmail in /home/stud/1/0472547/public_html/send_password.php on line 59

The code works but when wrong email is entered and it cant find it in the database it comes up with that error its all right but for some reason its saying undefined variable


// ---------------- SEND MAIL FORM ----------------

// send e-mail to ...
$to=$email_to;

// Your subject
$subject="Your password here";

// From
$header="from: your name <your email>";

// Your message
$messages= "Your password for login to Fast Learner \r\n";
$messages.="Your password is $your_password \r\n";
$messages.="more message... \r\n";

// send email
$sentmail = mail($to,$subject,$messages,$header);

}

// else if $count not equal 1
else {
echo "Not found your email in our database";
}

//=============error message is here cant figure it out where it says if ($sentmail){
// if your email succesfully sent
if($sentmail){
echo "Your Password Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send password to your e-mail address";
}

?>
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 154
Reputation: Suomedia is an unknown quantity at this point 
Solved Threads: 19
Suomedia Suomedia is offline Offline
Junior Poster

Re: send email Undefined variable:

 
0
  #2
Mar 27th, 2008
Somewhere up the top put:

  1. $sentmail = NULL;


Matti Ressler
Suomedia
Last edited by Suomedia; Mar 27th, 2008 at 6:34 pm.
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 63
Reputation: sukhy_1 is an unknown quantity at this point 
Solved Threads: 3
sukhy_1 sukhy_1 is offline Offline
Junior Poster in Training

Re: send email Undefined variable:

 
0
  #3
Mar 27th, 2008
Originally Posted by Suomedia View Post
Somewhere up the top put:

  1. $sentmail = NULL;


Matti Ressler
Suomedia
didnt work made more errors
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 154
Reputation: Suomedia is an unknown quantity at this point 
Solved Threads: 19
Suomedia Suomedia is offline Offline
Junior Poster

Re: send email Undefined variable:

 
0
  #4
Mar 27th, 2008
It did not make more errors at all (not possible), in fact its not need. I just ran what you posted (with a minor addition to make it complete) and received an email as expected.

The problem is elsewhere in your code. The actual error message would help.


Matti Ressler
Suomedia
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 63
Reputation: sukhy_1 is an unknown quantity at this point 
Solved Threads: 3
sukhy_1 sukhy_1 is offline Offline
Junior Poster in Training

Re: send email Undefined variable:

 
0
  #5
Mar 28th, 2008
Hello cant see what u mean it sends email when the email is found from the database but it when there isnt a password that matches it comes up with the right message but says undefined variable

Not found your email in our database
Notice: Undefined variable: sentmail in /home/stud/1/242422/public_html/send_password.php on line 100
Cannot send password to your e-mail address
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 154
Reputation: Suomedia is an unknown quantity at this point 
Solved Threads: 19
Suomedia Suomedia is offline Offline
Junior Poster

Re: send email Undefined variable:

 
0
  #6
Mar 28th, 2008
Well, as I first suggested, declare the variable:

  1. $sentmail = NULL;


Matti Ressler
Suomedia
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 1395 | Replies: 5
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC