Summary of small knowledge points. Checkbox usage inputtypecheckboxvaluecnameflags []? Phpif (strpos ($ row [flag], c )! False) echocheckedchecked ;? [C] inputtypech checkbox usage is recommended
/> Recommended [c]/> Special Recommendation [a]/> Toutiao [h]/> Popular [o]/> Latest [n]
Here, strpos is used to check whether a string is contained in the string!
Strpos returns an integer (logical false cannot be found)
'True' is converted to 0 in numerical comparison.
If the first character of $ row ['flag'] is c, it happens to be matched.
None of the other characters are returned, so the matching is not successful.
How to convert parameters to strings into arrays and display output.
Database insertion
else if($_GET['do']=='editok'){$id = $_POST['id'];$checked = $_POST['checked'];$flag = $_POST['flags'];$flags=implode(",",$flag);$sql = 'update djs_skstudent_voice set checked='.$checked.',flag="'.$flags.'" where id='.$id;$dsql->ExecuteNoneQuery($sql);echo "《script》 window.location.href='student_voice.php';《script》";}
Http://www.bkjia.com/PHPjc/729845.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/729845.htmlTechArticlecheckbox usage input id = "flagc" type = "checkbox" value = "c" name = "flags []"? Php if (strpos ($ row ['flag'], 'C ')! = False) echo "checked = 'checked '";? /[C] input id = "flaga" type = "ch...