Hi guys, I'm new to all this so I really need some advice!! I am doing up a data entry page for events, by clicking on 'submit', the data will be uploaded into the mysql database. All this poses no problem, but I need to create a php mail (mail.php) that upon clicking on 'submit' (events.php), an email will be sent to a colleague to tell her to go to this admin page which I have done up for her to approve or disapprove the event submission. As far as I know, 'submit' is only for the event form and not for the mail.php. But it would be stupid to put two buttons on the events.php... What should I do??
You should move code for sending emails to be part of add event routine. Mail is sent on successfull insert... Simple as that.
Hi! Thanks for your reply!! May I know what I should put? Let's say the mail function is in mail.php, how do I run the mail.php in this? if ($mailsent) { echo "The submission has been successful."; } else { echo "There was an error sending this data. Please retry"; } ?>
use the mail() function to shoot of an email. It's one easy line of code. http://us3.php.net/manual/en/function.mail.php
Hi I think I may not have made myself quite understandable: I have the following files: - event.php: the form - eventdata.php: the php file to insert info into the database - mail.php: contains mail() to send email reminder. Imagine an html form on event.php, and the submit button is only for submitting the info on the event, not for processing mail.php... <form method="POST" action="eventdata.php"> blah blah blah event details.... <input type=" submit " value=" Submit "> My only solution is to put "if event is sucessfully submitted, then the mail.php would be run", but WHERE and HOW do I do it in the following? Can someone help me with the code? if ($eventsent) { echo "The submission has been successful."; } else { echo "There was an error sending this data. Please retry"; } ?> Help!!!
if ($eventsent) { echo "The submission has been successful."; include("mail.php"); } else { echo "There was an error sending this data. Please retry"; } PHP: