I'm trying to pass a value in checkbox which is a variable assigned a value from a tabe within my database inside a while loop.
while($row = mysql_fetch_row($results)) {
list($id, $bannerName, $clientName, $Url) = $row;
echo '<tr>
<td width="10"><input type="checkbox" name="ckname[]" value="$id"></td>
<td width="25">';
print $id;
.
.
.
.
.
the (...) just signify theirs more code.
With the variable $id, which is used to pass the value. With the following print statement it does print the value of $id so it is been passed the values from the table. But when i pass the the variable $id, its passed as $id and not the value of that variable. Ive tryed taking away the double quotes, using single quotes etc so it doesnt seem to be that, as it has been with other issues i often have.
the following code is where it is been passed. And when i passed a value like "1" instead of the variable the code works fine.
case 'Delete':
if (isset($_GET['ckname'])) {
foreach ($_GET['ckname'] as $id)
mysql_query("DELETE FROM Banner WHERE id = '" . $id . "'");
print $id;
} else {
echo "No items selected";
}
break;
Any suggestions you may have that might help would be very much welcomed.
Regards,
Cathal