0

Is there any way to handle (detect checked, count checked etc) dynamically created checkboxes in HTML without Javascript? Php echoes these checkboxes and I dont know much Javascript.

Simple functions that could detect if the user, for example, has clicked exactly 6 checkboxes then it would process the element in Php.

I'm making a "Edit Featured Friends" kind of page in a social networking site context. Thanks!

1
  • PHP is a server-side language. If you want an event to fire on the client, then you will have to use Javascript. Commented Apr 6, 2013 at 16:10

1 Answer 1

2

Assuming your checkboxes are being generated something like this:

echo '<input type="checkbox" name="boxes[]" /> Some label';

Then on your server-side code receiving the POST request you can do this:

if( count($_POST['boxes']) != 6) die("Please check exactly 6 boxes");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.