Help me out here guys.
I have a list of users i select with check boxes.
I want to create an array that houses all the users name.
Then i use swift to send an email to all those users emails one at a time.
Help making the array?
Thanks
array
Moderator: General Moderators
That's at least two questions.
Your form field should use an array structured name, e.g.
...and so on.
The second part is retrieving that data as an array, which in this case (assuming you're using a POST method form, which you should be) will be accessible via $_POST['username'], in this case an array stored within that $_POST index.
Once you receive the POST data, use a foreach() loop on the $_POST['username'] array and send the email to those users, one per iteration.
Your form field should use an array structured name, e.g.
Code: Select all
<input type="checkbox" name="username[]" value="Jim" />Jim
<input type="checkbox" name="username[]" value="John" />JohnThe second part is retrieving that data as an array, which in this case (assuming you're using a POST method form, which you should be) will be accessible via $_POST['username'], in this case an array stored within that $_POST index.
Once you receive the POST data, use a foreach() loop on the $_POST['username'] array and send the email to those users, one per iteration.