PattyB Posted September 14, 2006 Share Posted September 14, 2006 Hello,I am currently trying to build a small mailing list. In the mysql table storing the subscribers info (called members), I have a field called groups. This field is populated from checklists and using serialize to store the values. (I know I shouldnt do it this way, but it has worked for the rest of the mailing list).I have created the page to send mail and on that the users checks what groups they want to send to. These results are sent to the form with $_POST['groups_input'].What I need help with is taking the array from the _POST, breaking it down by individual group, and comparing each of those to the array stored in the groups database. If there is a match than it would send the email.Im guessing to start I need to do something like this to break down the _POST into individual groups and put all the code in between the brackets :$selected_list = unserialize($groups_selected); foreach($selected_list as $list_group) {} Im new with all this and help would be very appreciated! Quote Link to comment Share on other sites More sharing options...
effigy Posted September 14, 2006 Share Posted September 14, 2006 Something like this?[code]<pre><?php $their_POST = array(1, 4, 99); $database_result = array( 1 => array('aaron', 'bob'), 2 => array('bob', 'laura'), 3 => array('jean', 'john'), 4 => array('jim', 'bill'), ); foreach ($their_POST as $key => $group_number) { if (is_array($emails = $database_result[$group_number])) { echo join(', ', $emails), '<br/>'; } else { echo 'Invalid group</br>'; } } ?></pre>[/code] Quote Link to comment 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.