
Archive Tutorials
Discussion Home
Login / Register
Board List
PHP programming
General
Links
How to save gas 25% or more
Marshall Reddick
Network
Marketing Forums
Income Tax Help
Lose 10 Pounds in 3 Weeks
PHP Forum Script
Online Contest

Learn PHP in 47 hours!
|
|
|
 |
|
|
|
email notification for my guestbook
by paldo on Sat 03/11/2006 01:48 AM |
I would like to get an email notification whenever a guest post a new message. I have add the following script at the end of the script: mail("myemailadress",$message,$subject); but I get a notification anytime somebody visit the guestbook also without posting. So I think I should add something like: <?php if($_POST['message']) mail("myemailadress",$message,$betreff); ?> but I do not get neither a error message nor a notification. Can you give me a good hint? Thanks
|
|
[Reply]
[Back to Top]
|
use the empty() function
by uclaboyz on Sat 03/11/2006 08:02 AM |
Hi there, Yeah, you almost got it. Try comparing user's input to empty string '' or use empty() function: <?php if(empty($_POST['message'])){ // display error message } else { // OK to send email mail("myemailadress",$message,$betreff); } ?> You can also do an if comparison this way: if($_POST['message']=='') Let me know if it works, Steven
|
|
[Reply]
[Back to Top]
|
also.... one more thing
by uclaboyz on Sat 03/11/2006 08:04 AM |
in your mail() function, you will need to pass in $_POST['message'] instead of just $message. Also, what is $betreff set to? Did you pass in an email header?
|
|
[Reply]
[Back to Top]
|
let me know...
by uclaboyz on Wed 03/22/2006 10:11 PM |
let me know if you are still having trouble with this... Good day!
|
|
[Reply]
[Back to Top]
|
I had fixed it
by paldo on Wed 03/29/2006 12:38 PM |
Dear uclaboyz Thanks for having looked into it !! It did not work because I had placed the mail("myemailadress",$message,$subject); at the end of the feedback form instead of at the end of the handle form. That means, it is not necessary to introduce an "if conditional". Paldo P.S Would you please replace the email address [myemailadress] on my first message by "myemailadress" ( to avoid spam mail)? Thank you
|
|
[Reply]
[Back to Top]
|
email removed
by uclaboyz on Wed 03/29/2006 02:44 PM |
yeah, good idea. Email removed as requested. So you still having trouble with your code, or problem solved?
|
|
[Reply]
[Back to Top]
|
Problem solved
by paldo on Wed 03/29/2006 11:04 PM |
Thank you, the script is now running as I like.
|
|
[Reply]
[Back to Top]
|
|
|
|
|
|