RyanSF07 Posted July 3, 2009 Share Posted July 3, 2009 Hi Guys, I'm trying to create an emailer for a teacher to use to email all of the students who have joined his/her class. The students have joined the online version of the teachers class by filling out a form indicating who their teacher is, the name of the class, their name, and their email address. The teachers have several classes. Ideally, to email everyone in a particular class, the teacher could select the class from a drop down menu. How can I assign all of the email address of the students in a class to a variable, so that when the class is selected from the drop down, it corresponds to a variable that represents the contact info for the whole class? Currently what I have lists all of the classes -- I'm stuck now on how to have the selected class in the dropdown menu correspond with the "contact_class" variable. All ideas greatly appreciated -- Thank you very much for your help! $query ="SELECT * FROM registered_users, classes WHERE registered_users.teacher_code = classes.teacher_teachercode AND registered_users.id = $_SESSION[user_id]"; $query_result3 = mysql_query($query); while ( $row3 = mysql_fetch_array ($query_result3)){ $options .= '<option value="'.$row3['class_id'].'">'.$row3['class_id'].'</option>'; $_SESSION[email] = $row3[email]; } $form = <<<EOD <form action = "contact_class_process.php" method = "post"> <table width="450"> <tr> <td class = "left"><p><b>To Everyone in:</b></p></td> <td class = "right"><select>$options</select> </td> </tr> <tr> <td class = "left"><p><b>From:</b></p></td> <td class = "right"><p>$_SESSION[name] :: $_SESSION[email]</p> </td> </tr> :: $contact_class = The $variable that represents everyone in the class selected in the dropdown :: mail($contact_class,$subject,$message,$headers); :: Link to comment https://forums.phpfreaks.com/topic/164600-help-with-an-array-to-variable-for-php-emailer/ Share on other sites More sharing options...
RyanSF07 Posted July 3, 2009 Author Share Posted July 3, 2009 Hi All, Could you help point me in the right direction for this (above). Basically, how do I join the selected class in the drop down to the email address of that class? thank you for your help Ryan Link to comment https://forums.phpfreaks.com/topic/164600-help-with-an-array-to-variable-for-php-emailer/#findComment-868503 Share on other sites More sharing options...
RyanSF07 Posted July 3, 2009 Author Share Posted July 3, 2009 This is all new to me : ) I'm going to try breaking this mailing process into two steps. The first step the user will only select the class from the "Select Class" drop drop down. In the next step I'll try to pull the corresponding email addresses using $_REQUEST['Select Class']; in the query. other ideas welcome Link to comment https://forums.phpfreaks.com/topic/164600-help-with-an-array-to-variable-for-php-emailer/#findComment-868528 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.