i m having multiple choices of colours with checkbox for each color.
i want to check if chosen color value exists in "array" then echo "checked";
This code works fine but at present i have to change the color value in the "in_array" code manually for each color.
<input type="checkbox" name="colors" id="colors" value="red" <? if(in_array('red', $colors)) echo "checked='checked'"; ?> />
so i thought of creating a function which will automatic check for color value existance and then will echo "checked".
but i am stuck in this below function
why is $clr giving output as ArrayArray. Its not splitting with explode.
foreach($chosencolors as $colr)
$cl = $colr ." "; // output as red,yellow
$clr = explode(" ",$cl);
echo $clr; // output as ArrayArray
echo $clr; // output as redyellow
is there any other way of doing the same task.