blink359 Posted July 21, 2010 Share Posted July 21, 2010 Hello, I am looking to create a form in which it gets a list of peoples emails from a database and then emails all of them via the web form. I am not sure how to do this so can someone give me a bit of guiding or show me somewhere on the internet or forum post that i can read up on this. Thank you Blink359 Quote Link to comment https://forums.phpfreaks.com/topic/208390-need-a-bit-of-guiding-with-an-idea/ Share on other sites More sharing options...
dezkit Posted July 21, 2010 Share Posted July 21, 2010 Use a while loop to send all people an email. Bonus: Ajax loader if your database is huge Quote Link to comment https://forums.phpfreaks.com/topic/208390-need-a-bit-of-guiding-with-an-idea/#findComment-1088978 Share on other sites More sharing options...
timvdalen Posted July 21, 2010 Share Posted July 21, 2010 These will get you started: http://www.tizag.com/phpT/examples/formex.php http://www.freewebmasterhelp.com/tutorials/phpmysql http://php.net/manual/en/function.mail.php Quote Link to comment https://forums.phpfreaks.com/topic/208390-need-a-bit-of-guiding-with-an-idea/#findComment-1088982 Share on other sites More sharing options...
blink359 Posted July 21, 2010 Author Share Posted July 21, 2010 Thanks for these sites, the one thing im not quite understanding is how im going to get all the emails out of the database and into the layout that i need for the email script, the database format is Name, Email. So i want to select all the email's out and then into a variable that i can put into the script, would i be able to get them all out as an array and then put that array variable into the reciepitants part of the script? (Hopefully that makes sense) Thanks Blink359 Quote Link to comment https://forums.phpfreaks.com/topic/208390-need-a-bit-of-guiding-with-an-idea/#findComment-1089000 Share on other sites More sharing options...
Wolphie Posted July 21, 2010 Share Posted July 21, 2010 Using MySQL functions you can extract each row from a table and it will be stored in an array. You can then use a while loop to loop through every row in the database and put it into an array, then use that array however you choose. Example: <?php $result = mysql_query("SELECT name, email FROM mailinglist"); while ($row = mysql_query($result)) { echo $row['name'] . '<br />'; echo $row['email'] . '<br />'; } ?> That will list all of the names and e-mail addresses stored in the database. Quote Link to comment https://forums.phpfreaks.com/topic/208390-need-a-bit-of-guiding-with-an-idea/#findComment-1089015 Share on other sites More sharing options...
blink359 Posted July 21, 2010 Author Share Posted July 21, 2010 Ok thanks Quote Link to comment https://forums.phpfreaks.com/topic/208390-need-a-bit-of-guiding-with-an-idea/#findComment-1089025 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.