andy_b_1502 Posted September 15, 2011 Share Posted September 15, 2011 Hi, ive been looking all over for a script to send an email once users on my site register their details, is this possible? all i want is it to send their username and password. Also the same sort of thing is needed for the "lost password" button? Any help suggested would be great, many thanks. Web Form/Registration: <form action="sendAd.php" method="post"> <h4 class="style7">Type of company (Removal, Transport, Storage, Insurance, Local Area or Other):<br /> <input type="text" name="type"/> <br />Company name:<br /> <input type="text" name="company_name"/> <br /> Location:<br /> <input type="text" name="location"/> <br /> Six bullet point description of your company:<br /> <textarea rows="6" cols="21" name="description" ></textarea> </h4> <h4 class="style7"> <br /> <input name="submit" type="submit" id="submit" value="List your ad" /> </h4> <p> </p> </form> SendAd.php: <?PHP $user_name = ""; $password = ""; $database = "removal2"; $server = "server"; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); if ($db_found) { $SQL = "INSERT INTO ads (type, company_name, location, description) VALUES ('" .$type. "', '" .$company_name. "', '" .$location. "', '" .$description. "')"; $result = mysql_query($SQL); mysql_close($db_handle); header( 'Location: http://www.removalspace.com/advert-confirm.php' ); exit(); } else { print "Database NOT Found "; mysql_close($db_handle); } ?> MOD EDIT: code tags added. Quote Link to comment https://forums.phpfreaks.com/topic/247214-need-some-help-with-user-notification-email/ Share on other sites More sharing options...
voip03 Posted September 15, 2011 Share Posted September 15, 2011 Send an email once users on my site register their details, is this possible? YES. http://php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/247214-need-some-help-with-user-notification-email/#findComment-1269662 Share on other sites More sharing options...
WebStyles Posted September 15, 2011 Share Posted September 15, 2011 Your variables are passed using the POST method, so you need to grab them all like this: $company_name = $_POST['company_name']; before you can insert them into a database. for sending an email, check out the mail function Quote Link to comment https://forums.phpfreaks.com/topic/247214-need-some-help-with-user-notification-email/#findComment-1269663 Share on other sites More sharing options...
Pikachu2000 Posted September 15, 2011 Share Posted September 15, 2011 When posting code, enclose it within the forum's . . . BBCode tags. Quote Link to comment https://forums.phpfreaks.com/topic/247214-need-some-help-with-user-notification-email/#findComment-1269721 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.