whizzykid Posted May 8, 2009 Share Posted May 8, 2009 Hi i have created my database and form but anytime people register i dont knw until i get to refresh my database. Can anyone help with a code to send me a mail anytime a new registration is done? this is my code mysql_select_db($database_inteecom_ellen, $inteecom_ellen); $Result1 = mysql_query($insertSQL, $inteecom_ellen) or die(mysql_error()); $insertGoTo = "Thank you.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_inteecom_ellen, $inteecom_ellen); $query_Recordset1 = "SELECT * FROM register"; $Recordset1 = mysql_query($query_Recordset1, $inteecom_ellen) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> Quote Link to comment Share on other sites More sharing options...
Potatis Posted May 8, 2009 Share Posted May 8, 2009 That's quite easy to do. All you need to do is search for a php mail script and add it to the bottom of that code that you posted, configured with your own email address as the receiver. Quote Link to comment Share on other sites More sharing options...
briant Posted May 8, 2009 Share Posted May 8, 2009 It's very easy actually. You use the mail function. Put this inside your success page. $youremailaddress = 'email@address.com'; $subject = 'Someone just signed up.'; $message = 'Go check it out.'; mail($youremailaddress, $subject, $message); Quote Link to comment Share on other sites More sharing options...
briant Posted May 8, 2009 Share Posted May 8, 2009 Actually, place it right after this line: $Result1 = mysql_query($insertSQL, $inteecom_ellen) or die(mysql_error()); That way, if someone refreshes the page, it won't send you an email every single time. Quote Link to comment Share on other sites More sharing options...
whizzykid Posted May 8, 2009 Author Share Posted May 8, 2009 Hi thank you used it this way but didnt work. mysql_select_db($database_inteecom_ellen, $inteecom_ellen); $Result1 = mysql_query($insertSQL, $inteecom_ellen) or die(mysql_error()); $youremailaddress = '..........@yahoo.com'; $subject = ' just Registered up.'; $message = 'one new entry.'; mail($youremailaddress, $subject, $message); Quote Link to comment Share on other sites More sharing options...
whizzykid Posted May 8, 2009 Author Share Posted May 8, 2009 Hi thank you it works but shows from "nobody" Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 8, 2009 Share Posted May 8, 2009 Check example 2 of the manual page. It'll show you how to do it. The manual really should be your first port of call for things like this. Quote Link to comment 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.