How to make a delete confirmation that need a minimum of 1 record to be deleted?

Funsize

New Member
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. Thankshere's the php code:\[code\]enter code here<script src="http://stackoverflow.com/questions/9263467/javascript.js" type="text/javascript"></script><?phpecho"<form method=POST action='action.php?act=delete'> <input type=checkbox name='checkbox[]' value='http://stackoverflow.com/questions/9263467/1'>1 <input type=checkbox name='checkbox[]' value='http://stackoverflow.com/questions/9263467/2'>2 <input type=checkbox name='checkbox[]' value='http://stackoverflow.com/questions/9263467/3'>3 <input type=submit value=http://stackoverflow.com/questions/9263467/Delete onClick='return del_confirm();'></form>";?>\[/code\]here's the javascript code:\[code\]enter code herefunction del_confirm(){var msg=confirm('Are you sure?');var c=document.getElementsByName('checkbox[]');if(msg){ for(i=0;i<c.length;i++) { if(c.checked) { return true; } else { alert("Select minimum of 1 record to be deleted!"); return false; } }}else{return false;} }\[/code\]
 
Back
Top