I've been trying to find an easy way to put a list of about 100 email addresses into a MySQL database using PHP (these are people who want their email addresses put in the database and not spam in any form).
So far I've come up with the idea of having a textarea where the list of email address can be pasted in from a Excel file (standard copy and paste). Each email address will be on a new line. What I need to do is be able to split the email addresses into seperate variables and then use a loop to put them into the database. I just can't figure out the best way to do this.
Any help would be gratefully appreciated.
Of course, if you can come up with a better method than I have please let me know.
Thanks.
Textarea list into MySql
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
If you POST the form then you should be able to get an array of emails by doing:
Code: Select all
$emails = explode("\n", $_POST['emails']);