How to make a delete confirmation that need a minimum of 1 record to be deleted?
<p>I need help on making a delete confirmation that need a minimum of 1 record to be deleted.
I'm still confused on making it. I think there's something wrong in my javascript code. Any help would much be appreciated. Thanks</p>

<p>here's the php code:</p>

<pre><code>enter code here

&lt;script src="javascript.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;?php
echo"&lt;form method=POST action='action.php?act=delete'&gt;
     &lt;input type=checkbox name='checkbox[]' value='1'&gt;1
     &lt;input type=checkbox name='checkbox[]' value='2'&gt;2
     &lt;input type=checkbox name='checkbox[]' value='3'&gt;3
     &lt;input type=submit value=Delete onClick='return del_confirm();'&gt;&lt;/form&gt;";
?&gt;
</code></pre>

<p>here's the javascript code:</p>

<pre><code>enter code here

function del_confirm()
{
var msg=confirm('Are you sure?');
var c=document.getElementsByName('checkbox[]');
if(msg)
{
    for(i=0;i&lt;c.length;i++)
    {
    if(c[i].checked)
    {
        return true;
    }
    else
    {
        alert("Select minimum of 1 record to be deleted!");
        return false;
    }
    }
}
else
{return false;}
    }
</code></pre>
