Web Development

How to show checkbox checked in PHP

<?php $country = array( 1 => ‘USA’, 2 => ‘UK’, 3 => ‘Japan’, 4 => ‘India’, 5 => ‘Australia’); $the_key = ‘Australia|UK|India’; // or whatever you want $myrow = explode(‘|’,$the_key); $containsSearch1 = array_intersect( $country,$myrow); foreach($country as $key=> $val) { if(in_array($val,$containsSearch1)) { echo “$val.<input type=’checkbox’ name=’check_list[]’ value=’”.$val.”‘ checked=’checked’ /><br />”; } else { echo “$val.<input type=’checkbox’… Continue reading How to show checkbox checked in PHP