php - Checkboxes and MySQL -
Not knowing the "Insert" checkbox in the database is not a normal case, I have a form with many checkboxes. About 25 checkboxes are with 1-25 each with the same names and values, now the thing is that I need the same name to run those scripts that prevents the selection of more than 4 checkboxes ...
HTML code
& lt; Input type = "checkbox" name = "ckb" id = "engineering workshop" value = 1 onclick = 'chkcontrol (0)'; & Gt; & Lt; Label = "engineering warehouse" & gt; Engineering workshops & lt; / Labels & gt; PHP code $ engineeringworkshops = mysqli_real_escape_string ($ dbcon, $ _POST ['cob']); $ Sql = "Include in Courses (Student, Engineering Work) Value ('$ studentid', '$ engineeringwokshops')"; The engworkshops column type is tinyint (4) set default value 0
< P> Use such HTML: & lt; Form & gt; & Lt; Input type = 'checkbox' name = 'data []' value = 'your id' /> Data & lt; Input type = 'checkbox' name = 'data []' value = 'other id' / & gt; Other data & lt; Input type = 'checkbox' name = 'data []' value = 'vanished id' /> OneMoreData // Other & lt; / Form & gt; How to handle this data in php?
Use this: $ engineering workshops = mysqli_real_escape_string ($ dbcon, $ _POST ['cob']); // Check the foreign currency ($ _ POST ['data'] $ items from the check box {// item $ sql do something in the = "Include in courses (student, proceeding) value ('$ item' , '$ Engineeringwokshops') "; }
Comments
Post a Comment