| | |
send email Undefined variable:
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 63
Reputation:
Solved Threads: 3
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";
}
?>
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";
}
?>
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
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
Suomedia - Dynamic Content Management
•
•
Join Date: Mar 2008
Posts: 63
Reputation:
Solved Threads: 3
•
•
•
•
Somewhere up the top put:
PHP Syntax (Toggle Plain Text)
$sentmail = NULL;
Matti Ressler
Suomedia
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
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
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
Suomedia - Dynamic Content Management
•
•
Join Date: Mar 2008
Posts: 63
Reputation:
Solved Threads: 3
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
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
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
Well, as I first suggested, declare the variable:
Matti Ressler
Suomedia
PHP Syntax (Toggle Plain Text)
$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
Suomedia - Dynamic Content Management
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: $_SESSION
- Next Thread: using statements in user defined functions
Views: 1395 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array autosuggest beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error explodefunction file files folder form forms function functions google hack href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search searchbox select server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web website xml youtube





