dynamic checkbox in PHP with database connection
<p>Here is what I tried to do. Please read through as I'll try best to explain my issue as I'm kinda new here.</p>

<p>(1) I have check boxes dynamically created and tried assigning check box name same as one of the data records in the SQL database.
  i.e there is a table column with the name 'sbstart' and I tried assigning the values of this table row to check boxes as check box name. example, sbstart has 3 rows which contains 1,2,3, so I tried assigning 1,2,3 as check box values. Here's the code for that.</p>

<pre><code>echo "&lt;table cellpadding='2' class='tablet' cellspacing='0'&gt;";
echo 
"&lt;tr&gt;
&lt;th class='tbldecor8'&gt;&lt;/th&gt;"
."&lt;th class='tbldecor2'&gt;"."Starting Cheque No"."&lt;/th&gt;"
."&lt;th class='tbldecor3'&gt;"."Ending Cheque No"."&lt;/th&gt;"
."&lt;th class='tbldecor4'&gt;"."Total No of Cheques remaining"."&lt;/th&gt;"
."&lt;th class='tbldecor5'&gt;"."Cheque Type"."&lt;/th&gt;"
."&lt;/tr&gt;";

    while ($reca = mysqli_fetch_array($result))
    {
    if($reca['sbstart'] != "" &amp;&amp; $reca['sbend'] !="") {
    $cxVal = $reca['sbstart'];
        echo "&lt;tr&gt;";
        echo "&lt;td class='tbldecor1'&gt;&lt;input type='checkbox' name='$cxVal'&gt;$cxVal&lt;/td&gt;";
        echo "&lt;td class='tbldecor2' style='text-align:center'&gt;".trim($reca["sbstart"])."&lt;/td&gt;";
        echo "&lt;td class='tbldecor3' style='text-align:center'&gt;".trim($reca["sbend"])."&lt;/td&gt;";
        echo "&lt;td class='tbldecor4' style='text-align:center'&gt;".trim($reca["totsb"])."&lt;/td&gt;";
        echo "&lt;td class='tbldecor5' &gt;SmithKline Beecham (Consumer)&lt;/td&gt;";
        echo "&lt;/tr&gt;";
        }
}
        echo "&lt;tr class='tbldecor6'&gt;&lt;/tr&gt;"; 
        echo "&lt;/table&gt;";
</code></pre>

<p>(2) Please read. Im coming to my issue. Secondly I wanted to check when user submits the form what values are selected through check boxes, get them and delete them. In order to do that to understand what options user has checked I used the following and it always giving 'No' as output.</p>

<pre><code>if(isset($_POST['submit']))
{
    if(isset($_POST['$cxVal'])){echo 'Yes';}else{ echo 'No';}
}
</code></pre>

<p>Well if you have a better idea/ correct ways of doing this please share. Thanks. </p>

<p>EDIT:
    </p>

<pre><code>&lt;html&gt;
&lt;form with PHP SELF......&gt;
&lt;div&gt;&lt;?php
echo "&lt;table cellpadding='2' class='tablet' cellspacing='0'&gt;";
echo 
"&lt;tr&gt;
&lt;th class='tbldecor8'&gt;&lt;/th&gt;"
."&lt;th class='tbldecor2'&gt;"."Starting Cheque No"."&lt;/th&gt;"
."&lt;th class='tbldecor3'&gt;"."Ending Cheque No"."&lt;/th&gt;"
."&lt;th class='tbldecor4'&gt;"."Total No of Cheques remaining"."&lt;/th&gt;"
."&lt;th class='tbldecor5'&gt;"."Cheque Type"."&lt;/th&gt;"
."&lt;/tr&gt;";

    while ($reca = mysqli_fetch_array($result))
    {
    if($reca['sbstart'] != "" &amp;&amp; $reca['sbend'] !="") {
    $cxVal = $reca['sbstart'];
        echo "&lt;tr&gt;";
        echo "&lt;td class='tbldecor1'&gt;&lt;input type='checkbox' name='$cxVal'&gt;$cxVal&lt;/td&gt;";
        echo "&lt;td class='tbldecor2' style='text-align:center'&gt;".trim($reca["sbstart"])."&lt;/td&gt;";
        echo "&lt;td class='tbldecor3' style='text-align:center'&gt;".trim($reca["sbend"])."&lt;/td&gt;";
        echo "&lt;td class='tbldecor4' style='text-align:center'&gt;".trim($reca["totsb"])."&lt;/td&gt;";
        echo "&lt;td class='tbldecor5' &gt;SmithKline Beecham (Consumer)&lt;/td&gt;";
        echo "&lt;/tr&gt;";
        }
}
        echo "&lt;tr class='tbldecor6'&gt;&lt;/tr&gt;"; 
        echo "&lt;/table&gt;";

?&gt;
&lt;input type="submit" name="del" id="del" value="Delete"&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/html&gt;
</code></pre>
