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); ?> Link to comment https://forums.phpfreaks.com/topic/157328-help-needed/ 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. Link to comment https://forums.phpfreaks.com/topic/157328-help-needed/#findComment-829261 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 protected]'; $subject = 'Someone just signed up.'; $message = 'Go check it out.'; mail($youremailaddress, $subject, $message); Link to comment https://forums.phpfreaks.com/topic/157328-help-needed/#findComment-829266 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. Link to comment https://forums.phpfreaks.com/topic/157328-help-needed/#findComment-829267 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 = '[email protected]'; $subject = ' just Registered up.'; $message = 'one new entry.'; mail($youremailaddress, $subject, $message); Link to comment https://forums.phpfreaks.com/topic/157328-help-needed/#findComment-829283 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" Link to comment https://forums.phpfreaks.com/topic/157328-help-needed/#findComment-829285 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. Link to comment https://forums.phpfreaks.com/topic/157328-help-needed/#findComment-829289 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.