hi everyone, I've got a problem here I am trying to delete the selected check box (s) that a user selects and then they clikc on a delete button to delete that particular elemnt. I have used an array of checkboxes to keep track of the values and I have used echo to ensure that the value is passed but the elements do not get deleted eventhough the variable holds to the email address that it needs to delete here's the code have a look and let me know what i'm doing wrong
[code=php]if(isset($_POST['Delete'])) {
$dels = $_POST['e'];
foreach($dels as $key => $value) {
$qu = "DELETE FROM mailinglists WHERE seminarID= 1 AND emailAddress='$value'";
echo $qu;
echo '<br />';
echo $value;
$res=@mysql_query($qu,$dbc);
}
if($res > 0) {
echo '<h1 id="mainhead">Deleted</h1>';
}else {
echo '<h1 id="mainhead">Error</h1>';
} }
[/COLOR]
$qu= "SELECT emailAddress FROM mailinglists WHERE seminarID = 1";
$sol=@($qu);
$num_rows = mysql_num_rows($sol);
if($num_rows > 0) {
echo '<table width="403" border="0" align="center" bgcolor="#ffffff">';
// this retrieves the results
while ($row=mysql_fetch_array($sol, MYSQL_ASSOC)) {
$eAdd = $row['emailAddress'];
// create a row for printing the results (email addresses)
echo '<tr><td align="left"><input type="checkbox" name="e[]" value="<?=$eAdd?>';
echo $eAdd;
echo '" title=' . $eAdd . '>';
echo $eAdd . '</input>
</td></tr>';
}
echo '<tr><td>
<input name="Delete" type="submit" value="Delete selected email address (s)" >
</td></tr></table>';
}[/code]
Thanks in advance