从复选框中获取ID

I'm trying to get the ID's from a load of checkboxes that are in rows that are printed out on a page using a while statement. Each row from the database has a checkbox next to it with the ID in the checkbox value.

Basically I want to do a update query on the checkbox-selected rows, using the ID.

The code for the checkboxes that I have used is:

<input type="checkbox" name="check_list[]" value="<? echo $rows['id']; ?>">

Then when the code for the submit is:

<?
if(!empty($_POST['check_list'])){
     foreach($_POST['check_list'] as $id){
        echo "$id was checked! ";
     }
   }
?>

Just wanted to echo out the results to test that it works before putting it into a query. Trouble is...nothing happens. I just get a blank screen. No error or anything. Surely it should work, it looks right but I don't understand why it doesnt work.

Any help is most appreciated! :)

Tested below code with one test.php file

<?php
if(!empty($_POST['check_list']))
{
     foreach($_POST['check_list'] as $id){
        echo "<br>$id was checked! ";
     }
}


?>

<form method="post" name="frm">
<input type="checkbox" name="check_list[]" value="1"> 1
<input type="checkbox" name="check_list[]" value="2"> 2
<input type="checkbox" name="check_list[]" value="3"> 3
<input type="checkbox" name="check_list[]" value="4"> 4
<input type="submit" name="submit" />
</form>

please check if you are getting $rows['id'] properly. Things should work fine otherwise.

Thanks.