heyhey01 Posted March 28, 2010 Share Posted March 28, 2010 I have made a members page where user input information into a form and it updates a certain table in the database. now when the user clicks on the submit button and updates the table in the database i want it to send me an email telling me there's been an update in the database and also what information has been added. can anyone help me with what to do. here is the form code below. the names of things have been changed. <tr><td>M name :</td><td> <input type="text" name="mname" maxlength="60"> </td></tr> <tr><td>please enter</td><td> <input type="text" name="hheight" maxlength="11"> </td></tr> <tr><td>Please enter height</td><td> <input type="text" name="height" maxlength="11"> </td></tr> <tr><td>Please enter the </td><td> <input type="text" name="area" maxlength="30"> </td></tr> <tr><td>Please enter the number</td><td> <input type="text" name="numb" maxlength="11"> </td></tr> <tr><th colspan=2><input type="submit" name="submit" value="update"></th></tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/ Share on other sites More sharing options...
TeddyKiller Posted March 28, 2010 Share Posted March 28, 2010 Send YOU an email, and not the user an email? Can you post the PHP including with this form? Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1033074 Share on other sites More sharing options...
heyhey01 Posted March 29, 2010 Author Share Posted March 29, 2010 Send YOU an email, and not the user an email? Can you post the PHP including with this form? Yes it is just email me when there is an update. Also am not sure what to write php wise for getting it to email me. could u give me an example on what to do? Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1033314 Share on other sites More sharing options...
TeddyKiller Posted March 29, 2010 Share Posted March 29, 2010 Well you said you've set it so that it updates the database. After the query you do to update the database, you'd put in something like.. $to = 'Your email address here' $subject = "Your subject here"; $message = "Your message will go here, including all variables etc."; $header = "From: $name <no-reply@horble.com> " . "\r\n"; $send = mail($to, $subject, $message, $header); Simple huh? Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1033321 Share on other sites More sharing options...
heyhey01 Posted March 31, 2010 Author Share Posted March 31, 2010 do i need to use somthing like phpmailer when trying to get the email to send after the update button has been clicked? Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1034706 Share on other sites More sharing options...
TeddyKiller Posted March 31, 2010 Share Posted March 31, 2010 No. I gave you a piece of code to use. Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1034737 Share on other sites More sharing options...
heyhey01 Posted April 22, 2010 Author Share Posted April 22, 2010 Were in my coding should i put the code you gave me? Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1046295 Share on other sites More sharing options...
oni-kun Posted April 22, 2010 Share Posted April 22, 2010 Where you want it to send the e-mail. Access the variables from your form via $_POST, If you need help with that just ask. Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1046296 Share on other sites More sharing options...
heyhey01 Posted April 22, 2010 Author Share Posted April 22, 2010 am now getting a parse error. Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1046300 Share on other sites More sharing options...
heyhey01 Posted April 22, 2010 Author Share Posted April 22, 2010 Where you want it to send the e-mail. Access the variables from your form via $_POST, If you need help with that just ask. Yes please can i have some help with that. Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1046301 Share on other sites More sharing options...
oni-kun Posted April 22, 2010 Share Posted April 22, 2010 What does the error contain? You can see for yourself what POST elements are like this: <?php if (isset($_POST['submit'])) { print "Name = " . $_POST['mname'] . "<br/>"; //Example showing POST element print_r($_POST); //List all the Data to see what was sent } ?> I'd recommend you view tutorials though on what you're doing. http://www.tizag.com/phpT/forms.php http://php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/196769-mail-and-update/#findComment-1046306 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.