I have a string that should control if the checkbox array is checked or not when i open the page...
I made a string which contain a value of 0 & 1 and deal with the string as an array
if 1=checked
note: I retreive my checkbox values from the database
<?
do{
?>
<tr>
<td><? $cost=$temprow3['cost'];?>
<input type="checkbox" name="pro[]" value="<? echo $cost;?>" <?php
$OK = isset($_POST['pro']);
if ($OK && in_array($cost, $_POST['pro'])) { ?>
checked="checked" <? $spec .="1"; ?>
<?php } else {$spec .="0"; } ?>
<? if($m != " "){
$my=strlen($m);
for ($i=0; $i<$my; $i++)
{
if( $m[$i] ==1 ){
?>
checked="checked" <? }}}?>
/>
<? echo ($temprow3['name']); ?> </td>
<td><? echo $cost;?> </td>
</tr><?
}while($temprow3 = $adb->fetch_array($result3));?>
the function of the String:
<? if($m != " "){
$my=strlen($m);
for ($i=0; $i<$my; $i++)
{
if( $m[$i] ==1 ){
?>
checked="checked" <? }}}?>
$m is the String, if the String is not empty, enter the String and see if 1 checked=checked
its not seem to work so if someone know a thing I can do please help