Jump to content

Combine existing groups into another option in dropdown?


SEVIZ

Recommended Posts

Thanks to a lot of help from this forum I am getting CLOSE to where I need to be.  Here is my current issue.

 

My code:

<?php 

mysql_connect("localhost", "XXXX", "XXXX") or die(mysql_error());
mysql_select_db("TEXT_TOOL") or die(mysql_error());

if (!empty($_POST["email"])) { 
    $q = "select `num` from sprint WHERE `dept` = '".mysql_real_escape_string($_POST["recip"])."'";
    $ret = mysql_query($q);
    $emails = array();
    while ($row = mysql_fetch_assoc($ret)) {
        $emails[] = $row['num'].'@messaging.sprintpcs.com';
    }
    if ($emails) {
        $ToEmail = implode(', ', $emails); 
        $EmailSubject = $_POST["subject"]."\r\n";
        $mailheader = "From: ".$_POST["email"]."\r\n"; 
        $MESSAGE_BODY = nl2br($_POST["message"]);
   // $MESSAGE_BODY .= ($_POST["auth"]); 
        mail($ToEmail,$EmailSubject, $MESSAGE_BODY,$mailheader) or die ("Failure"); 
    }

?>
----
<?php 
} else { 
?>

<form action="text_tool1.php" method="post">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
      <td valign="top">
      Send To:<br />
<?php 

$q = "select `dept` from sprint GROUP BY `dept`";
$ret = mysql_query($q);

print '<select name="recip">';
while ($row = mysql_fetch_assoc($ret)) {
    $email_sec = $row['dept'];
    print "<option value=\"$email_sec\">$email_sec</option>";
}
?>
         </select>
      </td>
   </tr>


<tr>
<td>Message:<br /><textarea name=message cols="20" rows="6" id="comment" maxlength="143"></textarea><br />
</td>
</tr>
<tr>
<td>
<input name="email" type="hidden" id="email" size="20" value="emailhere"></td>
</tr>

</table>
</form>
</body>
</html>
<?php 
}; 
?>

 

Right now it queries the DB and creates the choices in the dropdown based on groups of the "dept" row titles.  This works flawlessly.  But I now need to add more options in the same dropdown that combine some existing groups.  How would I do this?

 

Right now they show up as Tech, Sup, Bobs, Jims, etc.

I now need to add more options that combine them like this: Tech/Sup, Bobs/Jims/Tech, Tech/Sup/Bobs

 

How can I combine the existing options into a new option in the dropdown?

 

Thank you as always!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.