strafe 0 Newbie Poster

Hi

This is my first thread on here and wondering if anybody can help me, I want to make a database of groups with information and show this on a website then the viewer uses the checkboxes to select the groups they are interesting and contacting. I am okay in showing the results and the form along with email it is getting the selected boxes emails into a variable that is the problem. I am just trying to print the emails to test it and just finding it hard work as I have never tried something like this before.

This looks like a regular problem that has no clear answer on the web as I have searched (for some time) for any hint of an answer, so I think if this can be solved it would be helping lots of people not just me!

any help would be great, Thankyou in advance

heres my code:

<?php
$host="localhost"; 
$username="root"; 
$password="root"; 
$db_name="steve"; 
$tbl_name="groups"; 

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="">
<table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td colspan="4" bgcolor="#FFFFFF"><strong>select groups to contact</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>description</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Email</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id']; ?>"></td>
<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['name']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['description']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['email']; ?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="5" align="center" bgcolor="#FFFFFF"><input name="send" type="submit" id="send" value="Send"></td>
</tr>
<?
if(isset($_POST['send'])){
for($i=0;$i<$count;$i++){
$sel_id = $checkbox[$i];

$sql = "SELECT email FROM $tbl_name WHERE id='$sel_id'";

$result = mysql_query($sql);
}

while($row = mysql_fetch_row($sql)) {
    $email = $row;
	print "$email"
	}

}
mysql_close();
?>
</table>
</form>
</td>
</tr>
</table>