Dennis Ingham Posted March 12, 2007 Share Posted March 12, 2007 Hi I'm creating a user registration form where I want these actions to run when a button is submitted: 1. Insert data from form fields into my database (Mydb) 2. When data is inserted, then send an e-mail with to the adress defined in one of the form fields. The e-mail is carrying a userid defined in one of form fields. Right...what I want is to create a user. Insert the data into my table in my database. Then send en e-mail with the user-id (defined in my form) to a e-mail adress also defined in my form. How do i do this? Best regards //Dennis Link to comment https://forums.phpfreaks.com/topic/42395-insert-data-then-send-an-e-mail/ Share on other sites More sharing options...
papaface Posted March 12, 2007 Share Posted March 12, 2007 Thats a lot to ask. Maybe you can start/attempt to write some code, and then we will guide you from there. I will start you off. If you have a table with username and password fields then to insert data into those fields you would use: <?php $username = mysql_real_escape_string($_POST['username']); $pass = md5($_POST['password']); $sql = "insert into users (username,password) values ('{$username}','{$pass}')"; mysql_query($sql); ?> Link to comment https://forums.phpfreaks.com/topic/42395-insert-data-then-send-an-e-mail/#findComment-205659 Share on other sites More sharing options...
aebstract Posted March 12, 2007 Share Posted March 12, 2007 Also, after you enter your information, to send an email you will use the following code: mail ('mailto', 'subject', 'body'); Where mailto is who you want the email sent to, subject is the subject of the email and body is the message sent in the email. Each of those words can be replaced with whatever you choose, including variables that you set. Hope that helps some. Link to comment https://forums.phpfreaks.com/topic/42395-insert-data-then-send-an-e-mail/#findComment-205660 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.