Retrieve checkbox options after submit
<p>I am building this function which echo-s all table fields and has a checkbox along with it.</p>

<p>I need to print this fields after submission, i have this code, and no i haven't started something, not because i don't want but because i don't have any idea how to.. so i'm asking your help.</p>

<p>I need to print information in report.php please help.</p>

<pre><code>&lt;form action='report.php' method='post'&gt;

&lt;?php // Script 12.7 - sopping.php

$db = mysql_connect('localhost', 'root', '');
mysql_select_db('db_up', $db);

echo "&lt;table border='1' class='tabtext'&gt;";

$result = mysql_query("SELECT * FROM hostess");
$numrows = mysql_num_rows($result);
$numfields = mysql_num_fields($result);

// show headers
echo '&lt;thead&gt;&lt;tr&gt;';
for ($field = 0; $field &lt; $numfields; $field++) {
    $field_name = mysql_field_name($result, $field); // instead of $i
    echo '&lt;th&gt;&lt;label&gt;&lt;input type="checkbox" name="checkbox[' . $field_name . '][]" value="1"/&gt; ' . $field_name . '&lt;/label&gt;&lt;/th&gt;';
}

echo '&lt;/tr&gt;&lt;/thead&gt;';

echo '&lt;tbody&gt;';
for ($row = 0; $row &lt; $numrows; $row++) {
    $data = mysql_fetch_assoc($result);
    echo '&lt;tr&gt;';
    for ($field = 0; $field &lt; $numfields; $field++) {
        $field_name = mysql_field_name($result, $field);
        if (isset($_POST['checkbox'][$field_name])) {
            echo '&lt;td&gt;' . $data[$field_name] . '&lt;/td&gt;';
        }
    }
    echo '&lt;/tr&gt;';
}
echo '&lt;/tbody&gt;';
echo '&lt;/table&gt;';


?&gt;
&lt;input type='submit' value='Submit' /&gt;
&lt;/form&gt;
</code></pre>

<p>The report.php</p>

<pre><code>&lt;?php // Script 12.7 - sopping.php

$db = mysql_connect('localhost', 'root', '');
mysql_select_db('db_up', $db);

foreach($_POST['checkbox'] as $key =&gt; $value)

?&gt;
</code></pre>
