Do you know how to validate checkboxes in PHP so that the user can only tick a limited number?
[code=php]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <title>PHP Test</title> <link rel="stylesheet" type="text/css" href="/main.css"> <link rel="shortcut icon" href="/favicon.ico"> </head><body> <?php if(isset($_POST) && count($_POST)) { $count = 0; foreach($_POST as $key => $value) { if($value == "on") $count++; } echo "<p>$count</p>"; } else { ?> <form method="post"> <input type="checkbox" name="cb1" /><br> <input type="checkbox" name="cb2" /><br> <input type="checkbox" name="cb3" /><br> <input type="submit" /> </form> <?php } ?> </body></html>[/code]
Help @Javajoob spread the word by sharing this article on Twitter...