By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,288 Members | 3,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,288 IT Pros & Developers. It's quick & easy.

How to Get a Dynamic Checkbox Array to Variables

Expert 100+
P: 1,584
Hi, I want to submit this Form contents after validating them.This check box is inside a loop and it will display along with some products items .Before i submit the form i want to check whether user has selected at least one of the check boxes.
ex: for 3 products there will be 3 checkboxes in the out put page.
<!-- This check box is Dynamically Display from the PHP.
$id will make 1001,1002,1003 and it does not make any Duplicates.-->
<input type="checkbox" name="frm_chk_delete[]" value="'.$id.'" />

I am going to submit this using a image.

[HTML]<a href="javascript:update()"><img src="images_in/b_update.jpg" alt="Update" /></a>[/HTML]

And it will call for this JS

Expand|Select|Wrap|Line Numbers
  1. function update(){
  2.     document.inq_form.action="update.php";
  3.     document.inq_form.submit();
  4.     }
How do i genarate a error message when user does not select at least on of the check boxes before he Submit the form.
Mar 8 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Loop through the checkboxes and check each one for its checked value. If all of them are false, then return false to prevent the submit.
Mar 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.