Location: PHPKode > scripts > Create Your Own Directory > cms/admin/DBMAD/mailman/groupbox.php
<?php
if($block != true)
{
?>

<?php

if($firstgroup == null)
{
$firstgroup = "";
}

?>

<form name=groupform >
<?php
$qer = "select * from groupname";
//echo($qer);
$result = mysql_query($qer,$link);
echo "<select name=group onChange=change(this)>";
echo "<option>-</option>";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
{
	foreach ($line as $col_value) 
	{
		if($col_value != "")
		{
			if($col_value != $firstgroup)
			{
			echo "<option name=$col_value value=$col_value>$col_value</option>";
			}
			else
			{
			echo "<option name=$col_value value=$col_value selected>$col_value</option>";
			}
		}

	}
}
echo "</select>";
?>

</form>


<form action="index.php" method=post name=hide>
<input name=groupc type=hidden value="groupc">
<input name=group type=hidden value="">
</form>

<script language=javascript>
function change(sss)
{
//var sds = document.groupform.group.selected; 
var sds = sss.value; 
document.hide.group.value = sds;
//alert(sds);
document.hide.submit();
}
</script>

<?php	
if($firstgroup == "" || $firstgroup == null)
	$str = "Message";
else
	$str = "select name from mailid where groupn like \"$firstgroup\"";

//echo($str);
?>

<form name=mailids>
<select name=test multiple size=22 style="width: 150px;">

<?php
$maai = explode("||",$mails);
foreach($maai as $valuee)
{
	$qer = "insert into temptable values('$valuee')";
	//echo($qer);
	mysql_query($qer,$link);
}

$str4 = "select * from temptable";
$result4 = mysql_query($str4,$link);
$stack = array();
while ($line2 = mysql_fetch_array($result4, MYSQL_NUM)) 
{
$ss = $line2[0];
array_push($stack,$ss);
}

if($str != "Message")
{
	if($fp == "groupc" )
	{
		$qer = "delete from temptable";
		//echo($qer);
		mysql_query($qer,$link);		
	}

	$result = mysql_query($str,$link);
	while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
	{
		foreach ($line as $col_value) 
		{
		 if(!in_array(trim($col_value), $stack))
		 {
			echo("<option name=".$col_value." value=".$col_value.">".$col_value."</option>");
		 }	
		 else
		  {
			echo("<option name=".$col_value." value=".$col_value." 
				style=\"background-color:green; color: white; border: 1px white solid;\" >".$col_value.
				"</option>");
		  }
		}
	}
}
else
{
	echo("<option> Select a GROUP</option>");
}

?>

</select>
</form>
<?php
//print_r($stack);
?>
<?php
}
?>
Return current item: Create Your Own Directory